Re: multi-table unique index
От | Markus Bertheau |
---|---|
Тема | Re: multi-table unique index |
Дата | |
Msg-id | 1056395317.2537.3.camel@saphir обсуждение исходный текст |
Ответ на | Re: multi-table unique index (Michael A Nachbaur <mike@nachbaur.com>) |
Список | pgsql-sql |
В Пнд, 23.06.2003, в 20:34, Michael A Nachbaur пишет: > On Monday 23 June 2003 11:16 am, Markus Bertheau wrote: > > В Пнд, 23.06.2003, в 19:32, Michael A Nachbaur пишет: > > > Instead of using the "serial" datatype, you can set it to "int4 PRIMARY > > > KEY DEFAULT nextval(foo_type_id_seq)" and you can manually create the > > > sequence "foo_type_id_seq". > > > > > > This way all the tables share the same sequence. > > > > Yeah, but I want to force this behaviour. so that it cannot happen by > > accident when you insert records without relying on the sequence. > If you want to ensure that a value is unique when a record is inserted, even > if the user explicitly specifies an ID values, you can create a unique > trigger on the tables, but this depends on what you want to do. I believe what you described is what I want to do. What's a unique trigger, though? -- Markus Bertheau. Berlin, Berlin. Germany.
В списке pgsql-sql по дате отправления: