Re: Create a pg table from CSV with header rows

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Create a pg table from CSV with header rows
Дата
Msg-id 20050916021132.GA81960@winnie.fuhr.org
обсуждение исходный текст
Ответ на Create a pg table from CSV with header rows  (Robert Fitzpatrick <lists@webtent.net>)
Ответы Re: Create a pg table from CSV with header rows  (Doug Bloebaum <blabes@gmail.com>)
Список pgsql-general
On Thu, Sep 15, 2005 at 06:48:59PM -0400, Robert Fitzpatrick wrote:
> Anyone know a package that can do this? Perferrably a Unix/Linux
> package.

It would be trivial to write a script in a language like Perl to
read the first line of a file and generate a CREATE TABLE statement
from it, then issue a COPY command and send the rest of the file.
Determining the columns' data types would be a different matter:
if they weren't specified in the header then you'd have to guess
or perhaps make them all text.

--
Michael Fuhr

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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Asychronous database replication
Следующее
От: "Logan Bowers"
Дата:
Сообщение: BIG installations of PostgresQL?