Project

General

Profile

Bug #1479

[Wt::Dbo] [PostgresSQL] ptr.modify() : clear on collection

Added by Thomas Saquet over 9 years ago. Updated about 7 years ago.

Status:
InProgress
Priority:
Normal
Assignee:
Target version:
Start date:
10/16/2012
Due date:
% Done:

0%

Estimated time:

Description

Hello,

The method .clear() doesn't provide a correct SQL query to delete a complete collection for postgres SQL.

It provides :

delete from "FIRST_TABLE" 
join "SECOND_TABLE" on "SECOND_TABLE"."ID_IN_SECOND_TABLE" = "FIRST_TABLE"."ID_IN_FIRST_TABLE" 
where "SECOND_TABLE"."ID_IN_SECOND_TABLE" = idToDelete;

As you can see in the postgres documentation DELETE doesn't accept JOIN.

http://docs.postgresqlfr.org/9.0/sql-delete.html

It should be :

DELETE FROM "FIRST_TABLE"
USING "SECOND_TABLE"
WHERE "SECOND_TABLE"."ID_IN_SECOND_TABLE" = "FIRST_TABLE"."ID_IN_FIRST_TABLE"
AND "SECOND_TABLE"."ID_IN_SECOND_TABLE" = idToDelete;

Regards,

Thomas

Also available in: Atom PDF