Re: [PATCHES] WITH DELIMITERS in COPY

Поиск
Список
Период
Сортировка
От Gavin Sherry
Тема Re: [PATCHES] WITH DELIMITERS in COPY
Дата
Msg-id Pine.LNX.4.21.0204150132380.30483-101000@linuxworld.com.au
обсуждение исходный текст
Ответ на Re: [PATCHES] WITH DELIMITERS in COPY  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: [PATCHES] WITH DELIMITERS in COPY  (Peter Eisentraut <peter_e@gmx.net>)
Re: [PATCHES] WITH DELIMITERS in COPY  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
On Sun, 14 Apr 2002, Bruce Momjian wrote:

> 
> Gavin, I will do the legwork on this if you wish.  I think we need to

No matter. I intended to submit a patch to fix this.

> use DefElem to store the COPY params, rather than using specific fields
> in CopyStmt.

DefElem would have required modification of code outside the parser (to
keep utility.c and DoCopy() happy) or otherwise an even messier loop
executed as a result of CopyStmt than I have given in the attached patch, 
plus other issues with Yacc.

The patch attached maintains backward compatibility. The syntax is as
follows:

COPY [BINARY] <relname> [WITH OIDS] FROM/TO             [USING DELIMITERS <delimiter>]             [WITH [ DELIMITER
<delimiter>| NULL AS <char> | OIDS ]]
 

I was also going to allow BINARY in the WITH list, but there seems to be
little point.

Note that if you execute a query such as:

COPY pg_class TO '/some/path/file/out'USING DELIMITERS <tab>WITH DELIMITER '|';

The code will give preference to WITH DELIMITER.

If no one can find fault with this or my implementation, I'll follow up
with documentation and psql patches (not sure that there is much point
patching pg_dump).

Gavin

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] Bug #633: CASE statement evaluation does not short-circut
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [PATCHES] WITH DELIMITERS in COPY