0

im am importing data to postgresql with this comand

COPY codigos_postales 
(CPRO, CMUN, Nombre_Municipio, CP, Municipio_CP, Lugar_CP) 
FROM 'path' WITH DELIMITER E'/t';

But i got this error.

ERROR: COPY delimiter must be a single-byte character 

2 Answers 2

1

If you're trying to specify a tab as the delimiter, you want E'\t' (the escape character is a backslash not a forward slash) or just a literal tab ' '.

You can see that with:

regress=>     SELECT E'\t' AS backslash, E'/t' AS forwardslash;
 backslash | forwardslash 
-----------+--------------
           | /t
(1 row)

If the delimiter is actually the string /t then you won't be able to use COPY, as it only supports single character delimiters.

Sign up to request clarification or add additional context in comments.

Comments

0

your delimiter looks like a little bit complex but not a single byte char... Try with '\t'.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.