Search Postgresql Archives

Re: Updates and deletes with joins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 19 August 2008, Gordon <gordon.mcvey@xxxxxxxxxxxx> wrote:
> I want to be able to restrict any query that updates or deletes from
> the articles table so that they can only occur if there isn't a
> corresponding entry in the locks table.  As far as I can tell,
> however, you can't join tables when doing updates or deletes.  I know
> on the PHP side I can attempt to do a select on the locks table and
> only perform the delete if the select returns 0 rows, but I'd rather
> the update or delete query itself does the checking.  Can anyone help
> out?

The best way to implement this is through triggers on the target tables.

However, you can also do joins with updates and deletes (UPDATE ... FROM and 
DELETE ... USING).

-- 
Alan


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux