| От | Bruno Wolff III |
|---|---|
| Тема | Re: INSERT only under certain conditions (SELECT) |
| Дата | |
| Msg-id | 20020709121836.GA30146@wolff.to обсуждение исходный текст |
| Ответ на | Re: INSERT only under certain conditions (SELECT) (Joachim Trinkwitz <jtr@uni-bonn.de>) |
| Список | pgsql-sql |
On Mon, Jul 08, 2002 at 17:49:56 +0200, Joachim Trinkwitz <jtr@uni-bonn.de> wrote: > > Now I want to allow a user with id 123 only to insert a row in T if he > doesn't choose values from L with same 'art' and 'semester' values -- > in the examples user 123 has already chosen a kvvnr from semester > 2002ws in category 'art', so he shouldn't be allowed to insert the > values of the second row in table L. In the database you enforce this using a unique index. The application needs to be able to handle failures when you try to insert a duplicate key. If you can't afford to have a transaction fail part way through, then anything that writes that table should do a table lock at the start of the transaction.
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера