Import: empty string and expression

From: Quan Zongliang <quanzongliang(at)gmail(dot)com>
To: pgadmin-hackers(at)postgresql(dot)org(dot)
Subject: Import: empty string and expression
Date: 2009-02-24 09:23:26
Message-ID: 20090224174304.5BD4.4125B4E5@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi, all

String:
How to distinguish NULL and empty?

In the COPY command, it conside no quoted empty as NULL and quoted ones as empty.
This rule not defined in the CSV standard(RFC4180).
For example:
A,,B has three item: 'A', NULL and 'B'
A,"",B has three item: 'A', empty and 'B'
Should we follow this rule?
I think it is good.

Some code must be rewrited, because I treat both as empty now.
And with wxString, null and empty can't be distiguished.

Expression:
If end users decide to import with INSERT statement, they can define expressions.
(With other cases, only the constants can be used.
The pgLoader support this option. I forgot to support constants.
Thanks Guillaume, he introduced this good tool to me.)
Those ones must has one column and one row.
That is, it must can be valuated by SELECT statement emitted FROM clauses.

Now, I use <column-name> style in the expression.
The delimiter option use this style too. (<TAB> means TAB char.)
Exscaped char is XML-style, &amp; &lt; and &gt; , and so on.
Because I noticed pgAdmin has a option "Show NULL values as <NULL>".
Is it appropriate?

Regards.

-----------------------------------------------
Quan Zongliang
quanzongliang(at)gmail(dot)com
CIT Japan: http://www.cit.co.jp
CIT China: http://www.citbj.com.cn

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2009-02-24 09:43:52 Re: PATCH: Update autovacuum (for TOAST-TABLE) to use reloptions, instead of a system catalog
Previous Message Ashesh Vashi 2009-02-24 09:00:24 Re: PATCH: Update autovacuum (for TOAST-TABLE) to use reloptions, instead of a system catalog