Re: oid's and primary keys on insert

Поиск
Список
Период
Сортировка
От Rob Brown-Bayliss
Тема Re: oid's and primary keys on insert
Дата
Msg-id 1028923675.1838.14.camel@everglade.zoism.org
обсуждение исходный текст
Ответ на oid's and primary keys on insert  (Rob Brown-Bayliss <rob@zoism.org>)
Список pgsql-general
On Fri, 2002-08-09 at 21:34, Richard Huxton wrote:

> The standard way of doing this is with a sequence or the SERIAL type (assuming
> you don't have a natural primary key). You can use the currval() and
> nextval() functions to get the last used/next to use values for a given
> sequence. It works with multiple clients and there is now an int8 based
> version for those needing a lot of inserts.

Unfortunatley I am not useing a sequence directly, I am useing a text
field that is like this: 46-X

The X is a sequence, the 46 is site identification number, so that when
I replicate teh data to teh main site their is a way of knowing where it
came from, and also ensuring that the primary key for the table is
unique across several sites.  It is created and inserted by a trigger.

So as you can see I don't actually know what the key will be before an
insert.

Currently I can then get the oid and then get the primary key for that
table row, but if OIDs are banished then I am screwed...

--

*
*  Rob Brown-Bayliss
*

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

Предыдущее
От: David Wheeler
Дата:
Сообщение: Suppressing PostgreSQL NOTICEs
Следующее
От: Rob Brown-Bayliss
Дата:
Сообщение: Re: uncommited question