* Glenn Maynard (gl...@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
signature.asc
Description: Digital signature