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.