Nasty, propagating POLA violation in COPY CSV HEADER

Поиск
Список
Период
Сортировка
От David Fetter
Тема Nasty, propagating POLA violation in COPY CSV HEADER
Дата
Msg-id 20120620150254.GA11635@fetter.org
обсуждение исходный текст
Ответы Re: Nasty, propagating POLA violation in COPY CSV HEADER  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Nasty, propagating POLA violation in COPY CSV HEADER  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Folks,

A co-worker filed a bug against file_fdw where the columns in a
FOREIGN TABLE were scrambled on SELECT.  It turned out that this comes
from the (yes, it's documented, but since it's documented in a place
not obviously linked to the bug, it's pretty useless) "feature" of
COPY CSV HEADER whereby the header line is totally ignored in COPY
OUT.

Rather than being totally ignored in the COPY OUT (CSV HEADER) case,
the header line in should be parsed to establish which columns are
where and rearranging the output if needed.

I'm proposing to make the code change here:


http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/commands/copy.c;h=98bcb2fcf3370c72b0f0a7c0df76ebe4512e9ab0;hb=refs/heads/master#l2436

and a suitable doc change that talks about reading the header only for
the purpose of matching column names to columns, and throwing away the
output as before.

What say?

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: sortsupport for text
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: libpq compression