Re: INSERT only under certain conditions (SELECT)

Поиск
Список
Период
Сортировка
От 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 по дате отправления:

Предыдущее
От: Jan Wieck
Дата:
Сообщение: Re: Rule WHERE condition problem
Следующее
От: David Stanaway
Дата:
Сообщение: Re: is there a way to get hh:mm:ss given seconds