Re: [HACKERS] Sequences....
От | Vadim Mikheev |
---|---|
Тема | Re: [HACKERS] Sequences.... |
Дата | |
Msg-id | 36EDDC69.A103C33@krs.ru обсуждение исходный текст |
Ответ на | Re: [HACKERS] Sequences.... (Ryan Bradetich <rbrad@hpb50023.boi.hp.com>) |
Список | pgsql-hackers |
Ryan Bradetich wrote: > > > > Take the following example: > > CREATE TABLE foo (i SERIAL, t text); > > > > This creates table foo, index foo_i_key, and the sequence foo_i_seq. > > > > The sequence ocuppies three of the system tables: pg_class, pg_attribute, and > > pg_attrdef. When the table gets dropped, the table foo and foo_i_key are > > removed. The default portion of the sequence is also removed from the > > pg_attrdef system table, because the attrelid matches the table's oid. > > > > I believe this is incorrect ... I think the attrelid should match the seqences > > oid instead of the table's oid to prevent the following error: pg_attrdef->attrelid is used to store DEFAULT definition for particular attribute -> DEFAULT part of SERIAL definition will not work after this... > > > > Back to my origional point .. I think we need another system table to map the > > sequence oid to the table's oid. I've noticed this done with the inheritance, > > indexes, etc ... but I don't see a pg_sequence table. Sequences and tables are independent things - that's why there was no pg_sequence table. Currently each sequence has row in pg_class, i.e. sequences are special tables. But I agreed that we need in new table to reflect SERIAL <--> sequence dependencies. Vadim
В списке pgsql-hackers по дате отправления: