Re: Bit by "commands ignored until end of transaction block" again

Поиск
Список
Период
Сортировка
Искать
От
Stephen Frost
Тема
Re: Bit by "commands ignored until end of transaction block" again
Дата
Msg-id
20090723105516.GJ23840@tamriel.snowman.net
Ответ на
Список
Дерево обсуждения
Bit by "commands ignored until end of transaction block" again Glenn Maynard <glenn@zewt.org>
Re: Bit by "commands ignored until end of transaction block" again Richard Huxton <dev@archonet.com>
Re: Bit by "commands ignored until end of transaction block" again Glenn Maynard <glenn@zewt.org>
Re: Bit by "commands ignored until end of transaction block" again Joshua Tolley <eggyknap@gmail.com>
Re: Bit by "commands ignored until end of transaction block" again Alvaro Herrera <alvherre@commandprompt.com>
Re: Bit by "commands ignored until end of transaction block" again Joshua Tolley <eggyknap@gmail.com>
Re: Bit by "commands ignored until end of transaction block" again Chris <dmagick@gmail.com>
Re: Bit by "commands ignored until end of transaction block" again Craig Ringer <craig@postnewspapers.com.au>
Re: Bit by "commands ignored until end of transaction block" again Thomas Kellerer <spam_eater@gmx.net>
Re: Bit by "commands ignored until end of transaction block" again Stephen Frost <sfrost@snowman.net>
Re: Bit by "commands ignored until end of transaction block" again Richard Huxton <dev@archonet.com>
Re: Bit by "commands ignored until end of transaction block" again Glenn Maynard <glenn@zewt.org>
Re: Bit by "commands ignored until end of transaction block" again Craig Ringer <craig@postnewspapers.com.au>
Re: Bit by "commands ignored until end of transaction block" again Adrian Klaver <aklaver@comcast.net>
Re: Bit by "commands ignored until end of transaction block" again Richard Huxton <dev@archonet.com>
Re: Bit by "commands ignored until end of transaction block" again Glenn Maynard <glenn@zewt.org>
* Glenn Maynard (glenn@zewt.org) wrote:
> > The ORM can't control transactions, can't call functions or can't set
> > savepoints?
> 
> It can't write the necessary SQL to say "insert this unless it already
> exists", namely:

If it can't cleanly handle failure cases like this one, then I think
your issue is with your ORM and not with PG.  An INSERT failing on a
uniqueness violation is actually a rather big deal in a relational
database and not erroring on it goes quite against data integrity
considerations.

If your ORM could call a function instead, you could handle the insert
and error-check in the function, to make up for the lack of intelligence
in the ORM.  Another option would be to have a 'fake' table, which has
no rows in it and just has an 'ON INSERT' trigger that calls a function
to handle this.  That could also be a view with a do-instead rule, if
the ORM has to query the same table.

I would think the time would better be spent fixing the ORM though.
Thanks,
	Stephen
В списке pgsql-sql по дате отправления
От: Glenn Maynard
Дата:
От: Adrian Klaver
Дата:
FAQ