Re: Using oids

Поиск
Список
Период
Сортировка
От Jonathan Bartlett
Тема Re: Using oids
Дата
Msg-id Pine.GSU.4.44.0309031300270.23907-100000@eskimo.com
обсуждение исходный текст
Ответ на Re: Using oids  (Bo Lorentsen <bl@netgroup.dk>)
Список pgsql-general
> No it don't know anything about the table it insert into. I simply do
> the following :
>
> 1. INSERT data (comming from another layer)
> 2. Get the last oid
> 3. SELECT * FROM the same table where oid = what I just found.
>
> I know absolutly nothing about the table, and I like it this way :-)

The way I do it is to have a global sequence called 'objects' that spits
out 64-bit values, and then EVERY TABLE has a 64-bit field called
object_id, which defaults to nextval('objects') if I don't specify it.
So, on every table no matter what, I could do:

1. select nextval('objects');
2. INSERT data (comming from another layer, but set object_id to the
value I got in #1)
3. SELECT * FROM the same table where oid = what I just selected in #1

Jon


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

Предыдущее
От: Jonathan Bartlett
Дата:
Сообщение: Re: Using oids
Следующее
От: Bo Lorentsen
Дата:
Сообщение: Re: Using oids