Re: plpgsql copy import csv double quotes

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: PASCAL CROZET <pascal(dot)crozet(at)qualis-consulting(dot)com>, PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: plpgsql copy import csv double quotes
Date: 2019-10-09 21:25:06
Message-ID: 127ce77c-c58d-f69a-dea2-8e7010f8fd4f@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/9/19 2:20 PM, PASCAL CROZET wrote:
> Hi, MailingList
>
> PG 9.3 under Ubuntu 14.04 (I know, that’s obsolete, but we’re planning
> to move to pg 10 or more during 2020)
>
> I’ve experience issues with double quotes \34 inside fields, in a csv file.
>
> Ex :
>
> "value1","some text","other text with "double quotes" inside","last field"
>
> When I import this line in a table, with the exact column number, with
> the « copy » command in plpgslq, the import fails.

What is the actual command?

This is being done inside a plpgsql function, correct?

If inside a function what is the function code?

My guess is you need to use the CSV format to COPY:

https://stream.boxwatch.ru/docs/11/sql-copy.html

>
> Saying that too many fields are present.
>
> I tried to catch the double quotes and delete then, but that’s hard
> under AWK or sed
>
> *_________________________________*
>
> Cordialement, *Pascal CROZET*
>
> *DBA - *<http://www.qualis-consulting.com>Qualis Consulting
> <http://www.qualis-consulting.com/>
>
> •www.qualis-consulting.com <http://www.qualis-consulting.com/>•04 78 22
> 74 90
> •Le Bois des Côtes 1 – Bâtiment A
> •300 Route Nationale 6 – 69760 LIMONEST
> *_________________________________*
>
> GRANT and REVOKE trigger on a ddl_command_end event trigger but don't
> provide any information beyond whether it was a table, schema, function,
> etc. that was affected. No object IDs or the like are included. How
> would you find out which table had its ACLs modified?
>
> Also, why do grants and revokes have an object_type of 'TABLE' instead
> of lower case names like 'table' for all other event types?
>
>
> Thanks,
>
> Miles Elam
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-10-09 21:27:31 Re: Event Triggers and GRANT/REVOKE
Previous Message PASCAL CROZET 2019-10-09 21:20:02 plpgsql copy import csv double quotes