DELETE syntax on JOINS

From: Jean-Michel Pouré <jm(at)poure(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: DELETE syntax on JOINS
Date: 2009-08-22 07:40:55
Message-ID: 1250926855.5787.10.camel@acer
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Friends,

First, thank you very much for considering a fix on the GROUP BY issue.
I am starting a new thread about another issue:

It seems that DELETE cannot understand INNER JOINS and needs HAVING.

Read:
http://drupal.org/node/555562 (main message)
http://drupal.org/node/555648

I don't see why PostgreSQL would not be able to run queries like:

DELETE h
FROM history AS h
INNER JOIN term_node AS tn ON (h.nid = tn.nid)
INNER JOIN term_data AS td ON (td.tid = tn.tid)
WHERE h.uid = 2067 AND td.vid = 2

Ultimately, why not allow:

DELETE h, tn
FROM history AS h
INNER JOIN term_node AS tn ON (h.nid = tn.nid)
INNER JOIN term_data AS td ON (td.tid = tn.tid)
WHERE h.uid = 2067 AND td.vid = 2

IMHO this would improve compliance towards other database systems. To me
this seems to be in the reasonable scope of compatibility.

Kind regards,
Jean-Michel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2009-08-22 08:30:30 Re: SIGUSR1 pingpong between master na autovacum launcher causes crash
Previous Message Gokulakannan Somasundaram 2009-08-22 04:18:01 Re: Lazy Snapshots