Re: Problem with COPY

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: Problem with COPY
Дата
Msg-id 20060710092837.GC29774@webserv.wug-glas.de
обсуждение исходный текст
Ответ на Problem with COPY  ("Christian Rengstl" <Christian.Rengstl@klinik.uni-regensburg.de>)
Ответы Re: Problem with COPY
Список pgsql-general
am  10.07.2006, um 10:21:59 +0200 mailte Christian Rengstl folgendes:
> Hi everyone,
>
> I have a table with a surrogate key which is an integer sequence. Is
> there a way to load a file using COPY and tell postgresql not to
> insert into the primary key column?

Yes:

test=# create table foobar (id serial primary key, name text);
NOTICE:  CREATE TABLE will create implicit sequence "foobar_id_seq" for serial column "foobar.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "foobar_pkey" for table "foobar"
CREATE TABLE
test=*# copy foobar (name) from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> name1
>> name2
>> name3
>> \.
test=*# select * from foobar;
 id | name
----+-------
  1 | name1
  2 | name2
  3 | name3
(3 rows)


HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

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

Предыдущее
От: DANTE Alexandra
Дата:
Сообщение: Re: VACUUM and fsm_max_pages
Следующее
От: DANTE Alexandra
Дата:
Сообщение: Aim of --enable-thread-safety ?