2

I have an issue using FORCE NOT NULL in PostgreSQL.

I have a table with 10 columns and I need to load data to it from a CSV file.

I'm using the following query, which works perfectly:

COPY "myschema"."mytable" 
FROM '/var/www/myapp/myfile.csv' 
DELIMITERS '|' 
CSV 
FORCE NOT NULL 
attr1, attr2, attr3, attr4, attr5, attr6, attr7, attr8, attr9, attr10;

I need to know how to do this without explicitly coping all the columns as arguments to the FORCE NOT NULL because I have more tables with hundreds of columns that require this.

I tried FORCE NOT NULL *, FORCE NOT NULL * but the query returns an error. I can't find a solution to this on the Internet.

Thanks in advance for the help you can provide me!

1
  • You forgot to mention your version of PostgreSQL. Commented Dec 30, 2012 at 17:07

1 Answer 1

1

FORCE NOT NULL * is not valid postgresql. A patch for this was almost passed but rejected. Read this mailing list for the discussion.

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

1 Comment

I read the mailing list. It's seem not to be solution for what i need to do. Thanks for the help. =(

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.