Practical question.
От | louis gonzales |
---|---|
Тема | Practical question. |
Дата | |
Msg-id | 45FA0BAA.9030606@linuxlouis.net обсуждение исходный текст |
Ответ на | Re: Role & User - Inheritance? (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Practical question.
Re: Practical question. Re: Practical question. |
Список | pgsql-general |
Hello List, I want to write a statement-level trigger - one that happens once per statement - such that, immediately after an insert into a table(which gets a unique integer value as an ID from a defined sequence, being the primary key on the table), a new table is created with foreign key constraint on that unique ID. My concern is with what happens if two such inserts occur at almost the same time, what is the best way to ensure that I never miss the creation of one of the tables due to the 2nd one, possibly reading the same "max" or nextvalue that the immediate previous trigger read. As an example: insertX which initiates the trigger reads the 'nextvalue' from the sequence and begins to create the associcated table insertY happens almost at the same time, so that it gets the same 'nextvalue' from the sequence and would then create or attempt to create the 'same' assoicated table while missing it's 'true' 'nextvalue'. Thanks for any insight! -- Email: louis.gonzales@linuxlouis.net WebSite: http://www.linuxlouis.net "Open the pod bay doors HAL!" -2001: A Space Odyssey "Good morning starshine, the Earth says hello." -Willy Wonka
В списке pgsql-general по дате отправления: