Re: INSERT with SELECT not working in pgAdmin

Поиск
Список
Период
Сортировка
От Dmitriy Igrishin
Тема Re: INSERT with SELECT not working in pgAdmin
Дата
Msg-id AANLkTimwT4uie_kqCxQsODY=TCPv+d0+wzd2wtCQeasZ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: INSERT with SELECT not working in pgAdmin  (Stefan Wild <wilds81@yahoo.de>)
Список pgsql-general
Hey Stefan,

For surrogate keys there is no reason to calculate values manually.
You should use sequences instead. Please, see
http://www.postgresql.org/docs/8.3/static/sql-createsequence.html
You may also use a SERIAL data type which creates a sequence
for you automatically upon its creation. Please, see
http://www.postgresql.org/docs/8.3/static/datatype-numeric.html#DATATYPE-SERIAL
Since you execute INSERT command without specifying an "id" column,
and there is no default value for it, then the default is NULL. So, you need
to define a default and the best solution to define it as next value of sequence.

--
Regards,
Dmitriy


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

Предыдущее
От: Stefan Wild
Дата:
Сообщение: Re: INSERT with SELECT not working in pgAdmin
Следующее
От: "Rhys A.D. Stewart"
Дата:
Сообщение: versioned pl/pgsql functions