[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2973) drop table if exists SQL statement is wrong for PostgreSQL

Carl Allain (JIRA) noreply at atlassian.com
Wed Nov 28 11:39:56 EST 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2973?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28989 ] 

Carl Allain commented on HHH-2973:
----------------------------------

This was caused by a misconfiguration in the hibernate configuration file

I replaced
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
with
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>

to fix the problem.

> drop table if exists SQL statement is wrong for PostgreSQL
> ----------------------------------------------------------
>
>                 Key: HHH-2973
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2973
>             Project: Hibernate3
>          Issue Type: Bug
>    Affects Versions: 3.2.5
>         Environment: Windows XP, Postgres 8.2.5, Hibernate 3.2.5.ga
>            Reporter: Carl Allain
>            Priority: Minor
>
> I am using hibernate.connection.driver_class = org.postgresql.Driver
> When using hibernate.hbm2ddl.auto with create (to get a schema drop + a create)
> somewhere, Hibernate generates:
> 09:15:56,575 DEBUG SchemaExport:303 - 
>     drop table MESSAGES if exists
> 09:15:56,575 DEBUG SchemaExport:288 - Unsuccessful: drop table MESSAGES if exists
> 09:15:56,575 DEBUG SchemaExport:289 - ERROR: syntax error at or near "if"
> while the 8.2 posgresql doc says:
> DROP TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
> so it seems the "if exists" is at the wrong place for Postgresql (should be before the table name, not after)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list