DELETE Query generating invalid SQL for PostgreSQL databases.

Description

Using a JPA Delete query with conditions requiring a join through Hibernate entity-manager generates invalid SQL for PostgreSQL.

PostgreSQL cannot use CROSS JOIN in the FROM clause of a DELETE query.

For example: JPQL Query

Generates an (invalid) SQL query like:

For PostgreSQL I believe this needs to look like:

PostgreSQL documentation on the DELETE syntax:
http://www.postgresql.org/docs/8.1/static/sql-delete.html
http://www.postgresql.org/docs/9.1/static/sql-delete.html

Activity

Show:

Robin SanderDecember 2, 2015 at 9:41 AM
Edited

I'm able to reproduce this error with Hibernate 5.0.4 and PostgreSQL 8.4.22 using a CriteriaDelete query.
I've read http://in.relation.to/2015/10/27/great-jira-cleanup-2015/ and https://github.com/hibernate/hibernate-test-case-templates but I can't find a test template for a specific database (postgres in this case). Are there any postgres specific test cases to use as an example?

Christian BeikovOctober 30, 2015 at 10:56 AM

Duplicate but still relevant

Steve EbersoleOctober 28, 2015 at 3:26 AM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Steve EbersoleOctober 27, 2015 at 7:14 PM

This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.

For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/

Andrey DyominJune 8, 2012 at 4:19 PM
Edited

This error appears when use cascade delete too.
(PostgreSQL) 9.1.4 generate SQL exception.

Duplicate

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created May 10, 2012 at 4:24 PM
Updated December 20, 2016 at 10:06 PM
Resolved December 20, 2016 at 10:06 PM