[GENERAL] pgadmin - import a CSV with nulls?
От | George Neuner |
---|---|
Тема | [GENERAL] pgadmin - import a CSV with nulls? |
Дата | |
Msg-id | ajogqc51jhsugs73fe5tijhmrdk9u6jd9g@4ax.com обсуждение исходный текст |
Ответы |
Re: [GENERAL] pgadmin - import a CSV with nulls?
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: