Re: constraints & tableoid [pgsql8.1]

Поиск
Список
Период
Сортировка
От 姜维
Тема Re: constraints & tableoid [pgsql8.1]
Дата
Msg-id 443BB9AF.1080505@sduept.com
обсуждение исходный текст
Ответ на Re: constraints & tableoid [pgsql8.1]  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Tom Lane 写道:
> Michael Fuhr <mike@fuhr.org> writes:
>
>> Apparently a new row's tableoid isn't set until the row is actually
>> inserted.
>>
>
> I believe that's true of all the system columns.  If you're using oid,
> for example, that's not assigned either until heap_insert().
>
> This behavior doesn't seem unreasonable to me.  A candidate row is not a
> member of the table until *after* it's passed its constraint checks ---
> until then, it's just some values sitting in memory.
>
>             regards, tom lane
>
>
jw=# ALTER TABLE base DROP CONSTRAINT base_tableoid_check;
ALTER TABLE
jw=# ALTER TABLE base ADD CHECK (tableoid = 0);
ALTER TABLE
jw=# INSERT INTO base DEFAULT VALUES ;
INSERT 0 1
jw=# INSERT INTO base DEFAULT VALUES ;
INSERT 0 1
jw=# INSERT INTO base DEFAULT VALUES ;
INSERT 0 1
jw=# select *,tableoid from base;
tableoid
----------
301146
301146
301146
(3 rows)
jw=# \d+ base
Table "public.base"
Column | Type | Modifiers | Description
--------+------+-----------+-------------
Check constraints:
"base_tableoid_check" CHECK (tableoid = 0::oid)
Has OIDs: no




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: constraints & tableoid [pgsql8.1]
Следующее
От: "Peter Brant"
Дата:
Сообщение: Re: right sibling is not next child