RE: unable to read composite types from CSV files

Поиск
Список
Период
Сортировка
От Ian Bell
Тема RE: unable to read composite types from CSV files
Дата
Msg-id !&!AAAAAAAAAAAYAAAAAAAAADldbAmb6+pIq6nH7MxZl07CgAAAEAAAADAjdnUJ3pxGts1oN4KodRUBAAAAAA==@ianbellsoftware.com
обсуждение исходный текст
Ответ на Re: unable to read composite types from CSV files  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: unable to read composite types from CSV files  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: unable to read composite types from CSV files
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: unable to read composite types from CSV files