Re: Import: empty string and expression

Поиск
Список
Период
Сортировка
От Quan Zongliang
Тема Re: Import: empty string and expression
Дата
Msg-id 20090226102030.54CC.4125B4E5@gmail.com
обсуждение исходный текст
Ответ на Re: Import: empty string and expression  (Dave Page <dpage@pgadmin.org>)
Ответы Re: Import: empty string and expression  (Quan Zongliang <quanzongliang@gmail.com>)
Re: Import: empty string and expression  (Dave Page <dpage@pgadmin.org>)
Список pgadmin-hackers
> Why do we need to escape those characters? If I follow correctly, this
> will be in an expression that the user enters themselves?
I am sorry, Dave.
That description is not clear. You know, my English is bad.

There, the column mean CSV file's column, not table column.
The end user can set a option "First row is header".
CSV's first row will be consided column names.
If not, they will be "Column #1, Column #2, Column #3 ..."
Then, in the expression, the end user can input "<Column #1> || substring(<Column #3> from 2 for 1)".
It will be convert to corresponding row's data for every statement.

For example:
A1,B1,C1,D1,E1,F1 -->  'A1' || 'C1'
A2,B2,C2,D2,E2,F2 -->  'A2' || 'C2'
...

INSERT INTO t_name(col_list) VALUES( [some values], 'A1' || substring('C1' from 2 for 1), [some values]);
INSERT INTO t_name(col_list) VALUES( [some values], 'A2' || substring('C2' from 2 for 1), [some values]);
...

I think it is useful when the end user want to import the CSV data with different columns to table.

Regards.

-----------------------------------------------
Quan Zongliang
quanzongliang@gmail.com
CIT Japan:  http://www.cit.co.jp
CIT China:  http://www.citbj.com.cn


В списке pgadmin-hackers по дате отправления:

Предыдущее
От: Guillaume Lelarge
Дата:
Сообщение: Re: Server Status window work
Следующее
От: Quan Zongliang
Дата:
Сообщение: Re: Import: empty string and expression