Re: Importing data

Поиск
Список
Период
Сортировка
От nconway@klamath.dyndns.org (Neil Conway)
Тема Re: Importing data
Дата
Msg-id 20020729174912.GA8396@klamath.dyndns.org
обсуждение исходный текст
Ответ на Importing data  (Patrick Nelson <pnelson@neatech.com>)
Список pgsql-general
On Mon, Jul 29, 2002 at 10:34:31AM -0700, Patrick Nelson wrote:
>   COPY mss FROM '/subset.csv' USING DELIMITERS ',';
>
> Which imports a file like:
>
>   ,1,SLWS,SLWS DATA,$489.18M,6,1,1,0,0,8,1.37,Sat Jun 29 12:42:47 PDT 2002
>   ,2,SRDE,SRDE DATA,$232.30M,0,0,2,0,0,2,3,Sat Jun 29 12:43:00 PDT 2002
>   ...
>
> However, id doesn't get populated with a sequence of numbers.  Note that the
> 1 and 2 of the above import file is being properly dumped into ind, even
> though I have to add "," to the beginning of each line.  So I think that I
> don't really get it.

If data for an attribute is missing, it will be set to NULL in 7.2 and
earlier versions of PostgreSQL. This behavior will be fixed in 7.3, but
until then, you can set the "id" column yourself:

COPY ...;
UPDATE mss SET id = nextval('mss_id_seq');

Cheers,

Neil

--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC

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

Предыдущее
От: Patrick Nelson
Дата:
Сообщение: Importing data
Следующее
От: Robert Treat
Дата:
Сообщение: Re: phpPgAdmin problem