Re: Import: empty string and expression

From: Quan Zongliang <quanzongliang(at)gmail(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: Import: empty string and expression
Date: 2009-02-26 01:44:42
Message-ID: 20090226102030.54CC.4125B4E5@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)com
CIT Japan: http://www.cit.co.jp
CIT China: http://www.citbj.com.cn

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Quan Zongliang 2009-02-26 01:47:02 Re: Import: empty string and expression
Previous Message Guillaume Lelarge 2009-02-25 19:35:57 Re: Server Status window work