Search Postgresql Archives

pgadmin - import a CSV with nulls?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm trying to move some data between databases that have different
structure, and I'm stuck on how to import a CSV file that contains
nulls.

Both databases are remote, so COPY is not an option - I don't have
shell or filesystem access to the servers.


pgAdmin 4 seems useless: it neither lets me reorder exported columns,
nor does it allow me to write query results to a file.  I really don't
want to have to create an import staging table with structure matching
the export [if that even would work] because there are a number of
tables involved and quite a lot of data to be moved.


pgAdmin 3 lets me write query results to a file, but I can't figure
out how to import null values back in.  The only option for specifying
nulls in CSV appears to be "" (empty string), but import chokes on
that.

I have seen posts on stackoverflow advising: e.g., to "edit the CSV
file to change nulls to \N and specify '\N' in the import options".
But this doesn't appear to work with pgAdmin 3.

I have tried using the empty field (e.g., blah,,blah ), the empty
strings '' and "", and every permutation of \N, '\N', and "\N".  I've
been at this for a couple of hours now and I can't find a solution
that works.  No matter what I try I get "invalid input syntax for type
..." when import hits the first null value.


Does anyone know a way to do this reliably?

Thanks,
George



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux