Re: [GENERAL] serial type

Поиск
Список
Период
Сортировка
От Charles Tassell
Тема Re: [GENERAL] serial type
Дата
Msg-id 4.1.19990928031028.00942ba0@mailer.isn.net
обсуждение исходный текст
Ответ на [GENERAL] serial type  (Greg Beams <gob@cat.cs.mu.OZ.AU>)
Список pgsql-general
What is the syntax you are using for the insert?

This:

INSERT INTO comment VALUES (, 'Example');

or this

INSERT INTO comment (rec_id, locale) VALUES (, 'Example');

won't work.  You have to *specifically* leave out the sequence field in
your field list, like this:

INSERT INTO comment (locale) VALUES ('Example');

It works the same for any default value, which is basically what a sequence
is (type sequence = int default nextval('sequence') )

At 01:45 AM 9/28/99, Greg Beams wrote:
>I'm trying to create a table as such:
>
>create table comment
>(rec_id serial,
>locale varchar(50),
>...)
>
>It creates correctly, telling me that it will create an implicit sequence
>for the serial column, and an implicit index for the table.  But, when I
>try to insert a record into the database (without specifying the value for
>the rec_id column) I get the following error:
>
>ERROR:  serial.nextval: sequence does not exist
>
>Does anyone have any ideas (I'm not sure whether this belongs on this
>list, or the pgsql-sql list)?
>
>Thanks, Greg.
>
>Greg Beams - gob@students.cs.mu.oz.au
>
>I'M NOT OKAY, YOU'RE NOT OKAY--BUT, HEY, THAT'S OKAY.
>
>
>************
>


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

Предыдущее
От: greg@proterians.net
Дата:
Сообщение: Re: [GENERAL] backend crashing with INTERSECT / ORDER BY
Следующее
От: Holger Klawitter
Дата:
Сообщение: 6.5.2 unter Solaris 2.6 feedback