Postgres Join Delete Query

SQL-99 does not allow to delete data in a table when using JOINS. The reasons for this are quite obscure. Maybe it was considered too complicated to implement. Therefore for safety reasons it was not part of the standard.

As a result, MySQL implemented this feature and PostgreSQL rejected it.

The following query works under MySQL but fails under PostgreSQL:

 

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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s