RE: unable to read composite types from CSV files - Mailing list pgsql-novice

From Ian Bell
Subject RE: unable to read composite types from CSV files
Date
Msg-id !&!AAAAAAAAAAAYAAAAAAAAADldbAmb6+pIq6nH7MxZl07CgAAAEAAAADAjdnUJ3pxGts1oN4KodRUBAAAAAA==@ianbellsoftware.com
Whole thread Raw
In response to Re: unable to read composite types from CSV files  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: unable to read composite types from CSV files
List pgsql-novice

Hello David,

 

Bingo!   I changed the CSV file to the following and it works!

 

"(1, 2, 3)"

"(4, 5, 6)"

"(7, 8, 9)"

 

If you don’t mind, could you point out the section in the PostgreSql manual/documentation where this is discussed/explained.  I have repeatedly read section 8.16.6 (i.e. Composite Type Input and Output Syntax) but it does not appear to include this detail.

 

I spent the whole day struggling with this problem and I am very much relieved that you were able to offer a solution so quickly.   A big thanks!

 

Ian

 

 

From: David G. Johnston [mailto:david.g.johnston@gmail.com]
Sent: 19 April, 2018 20:34
To: ib@ianbellsoftware.com
Cc: pgsql-novice <pgsql-novice@postgresql.org>
Subject: Re: unable to read composite types from CSV files

 

On Thursday, April 19, 2018, Ian Bell <ib@ianbellsoftware.com> wrote:

2)      If composite types can indeed be read/imported from CSV files then would you please take a look at the sample code/data provided below and tell me why it generates the error message ‘extra data after last expected column’.   In other words, what am I doing wrong?

Test CSV file contents

The contents of the CSV file (i.e. ‘testComposite.csv’) is:

 

(1,2,3)

(4,5,6)

(7,8,9)

 

 

Your csv data contains commas.  In order to treat them as data instead of structure you have to double-quote the field/value containing the affected data.

 

David J.

pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: unable to read composite types from CSV files
Next
From: "David G. Johnston"
Date:
Subject: Re: unable to read composite types from CSV files