Re: serial, sequence, and COPY FROM

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: serial, sequence, and COPY FROM
Дата
Msg-id 20060912192220.GA57867@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: serial, sequence, and COPY FROM  ("Brandon Aiken" <BAiken@winemantech.com>)
Список pgsql-general
On Tue, Sep 12, 2006 at 02:48:30PM -0400, Brandon Aiken wrote:
> Serial fields have a default value of nextval, so if you add an 18th
> field to your text file with DEFAULT in every record it should work as
> intended.

DEFAULT works with INSERT but not with COPY:

test=> CREATE TABLE foo (col1 integer, col2 integer, col3 serial);
NOTICE:  CREATE TABLE will create implicit sequence "foo_col3_seq" for serial column "foo.col3"
CREATE TABLE
test=>  COPY foo FROM stdin DELIMITER '|';
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> 1|2|DEFAULT
>> \.
ERROR:  invalid input syntax for integer: "DEFAULT"
CONTEXT:  COPY foo, line 1, column col3: "DEFAULT"

--
Michael Fuhr

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: serial, sequence, and COPY FROM
Следующее
От: Zlatko Matić
Дата:
Сообщение: program for graphical/schematical representation of relations between tables