From: | Ron <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: delimeters psql /CSV |
Date: | 2019-06-07 11:24:45 |
Message-ID: | ea3db701-8a21-a9b4-f400-f69f780e3900@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 6/7/19 5:01 AM, paul(dot)malm(at)lfv(dot)se wrote:
>
> Hi, I have a problem with psql and CSV.
>
> C:\Users\an\bin>C:\Tmp\psql -h 10.211.43.22 -p 5432 -U postgres -d aatest
> -w -c "\copy public.""Bayern"" FROM 'C:\Users\an\test\Bayern.csv' WITH
> DELIMITER ';' CSV"
>
> Error: extra data after expected last column
>
> CONTEXT: COPY Bayern, row 1:
> "48.455555555555556;11.800833333333333;Anglberg/Amper;Industrial
> plant;722;220;220;2133;0;0;Undefined..."
>
> I have a table (Bayern) with all columns in the right format. There is a
> column-value which has a ‘/’ in the string (Anglberg/Amper). I think that
> ‘/’ is taken for a delimeter, since when I replace / with ‘white space‘ it
> works.
>
> I use ‘;’ as delimeter. I have UTF-8 encoding in the db. Is there a way
> around this or do I have to go through all csv files and change ‘/’ to
> white space?
>
What if you escape the slashes with backslashes?
--
Angular momentum makes the world go 'round.
From | Date | Subject | |
---|---|---|---|
Next Message | Ict Security | 2019-06-07 11:58:04 | Strange connection limit problem |
Previous Message | Kyle Lee | 2019-06-07 11:24:33 | RE: Copyright and bundling the installer |