Re: data dependent sequences?

Поиск
Список
Период
Сортировка
От chester c young
Тема Re: data dependent sequences?
Дата
Msg-id 609880.51564.qm@web54306.mail.re2.yahoo.com
обсуждение исходный текст
Ответ на data dependent sequences?  ("Stuart McGraw" <smcg2297@frii.com>)
Список pgsql-sql
> 
> CREATE TABLE items (
>     id INT,
>     typ INT    ...
>     PRIMAY KEY (seq,typ));
> 

>    id   typ
>   ----+-----
>     1   'a'
>     2   'a'
>     3   'a'
>     1   'b'
>     4   'a'
>     2   'b'
> 

you will need to use pre insert trigger since you cannot use column
references in default expression.

you could use this same trigger to either:
- create sequences as needed and apply the right one
- with locking, lookup for last id of typ
- with locking, keep another table of typ and nextval


      
____________________________________________________________________________________
Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC


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

Предыдущее
От: Ragnar
Дата:
Сообщение: Re: data dependent sequences?
Следующее
От: Dani Castaños
Дата:
Сообщение: Having the sum of two queries