Thread: Explicit NULL for no INTEGER data?
I have a data file I want to copy into a table. The column name and attribute is: depth_seal INTEGER one of the rows in the .csv file I want to bring into the table has no value for this column, but there is no explicit NULL in the text file. When I try to copy the file psql complains: ERROR: invalid input syntax for integer: "" CONTEXT: COPY water_well, line 1, column depth_seal: "" Do I need an explicit NULL in that column? Rich
On Fri, 18 Feb 2011, Rich Shepard wrote: > Do I need an explicit NULL in that column? Update: Placing NULL or a blank produces the same error. How should I represent no value for an integer column in a .csv file? Rich
Judging from: http://www.postgresql.org/docs/8.1/static/sql-copy.html It looks like you have to specify your own NULL string with the NULL AS parameter of the COPY command. On Fri, Feb 18, 2011 at 3:12 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote: > On Fri, 18 Feb 2011, Rich Shepard wrote: > >> Do I need an explicit NULL in that column? > > Update: Placing NULL or a blank produces the same error. > > How should I represent no value for an integer column in a .csv file? > > Rich > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general >
On Fri, 18 Feb 2011, Mike Christensen wrote: > It looks like you have to specify your own NULL string with the NULL > AS parameter of the COPY command. Mike, I completely missed that option when I've read the copy page. My apologies! Rich
>> It looks like you have to specify your own NULL string with the NULL >> AS parameter of the COPY command. > > Mike, > > I completely missed that option when I've read the copy page. My > apologies! > > Rich Awesome, I'm the one usually asking easy questions on this mailing list so I'm just glad I could answer one for once!