You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Ryosuke Iwata (JIRA)" <ji...@apache.org> on 2007/11/01 15:12:51 UTC

[jira] Resolved: (OPENJPA-426) Incorrect DEFERRABLE usage with PostgreSQL

     [ https://issues.apache.org/jira/browse/OPENJPA-426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryosuke Iwata resolved OPENJPA-426.
-----------------------------------

       Resolution: Duplicate
    Fix Version/s: 1.1.0

I'm very sorry that this issue has been already reported and fixed. I confirmed this is fixed in a nightly build of 1.1.0.
https://issues.apache.org/jira/browse/OPENJPA-282


> Incorrect DEFERRABLE usage with PostgreSQL
> ------------------------------------------
>
>                 Key: OPENJPA-426
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-426
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 1.0.0
>         Environment: PostgreSQL database 8.1.
>            Reporter: Ryosuke Iwata
>             Fix For: 1.1.0
>
>
> OpenJPA generates incorrect CREATE TABLE statements with PostgreSQL, and you will get syntax errors.
> OpenJPA adds "DEFERRABLE" to unique constraints, probably because PostgresDictionary sets "true" as "supportsDeferredConstraints", while PostgreSQL accepts "DEFERRABLE" only with foreign key constraints.
> The description of "CREATE TABLE" in the PostgreSQL documents is so confusing : the syntax description at the top of the page makes us feel that "DEFERRABLE" can be specified with any table constraints, but you can find that it says "Only foreign key constraints currently accept this clause" in the middle of the page. See:
> 	http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html
> As a result of this confusion, SQL statements which OpenJPA generates result in database errors saying :
> 	syntax error at or near "DEFERRABLE"
> An example of generated SQLs is :
> 	CREATE TABLE PUBLIC.FOO (entityId BIGINT NOT NULL,
> 	memo TEXT, name VARCHAR(255) NOT NULL,
> 	entityVersion INTEGER NOT NULL,
> 	PRIMARY KEY (entityId), UNIQUE (name) DEFERRABLE);
> As a workaround, you can add the following line in the persistence.xml to avoid this problem:
> 	<property name="openjpa.jdbc.DBDictionary" value="postgres(SupportsDeferredConstraints=false)"/>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Resolved: (OPENJPA-426) Incorrect DEFERRABLE usage with PostgreSQL

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Iwata san,

Please do not feel bad. This is the way the process works. There are  
many issues in the system and it might not be so easy to find in jira  
the exact same problem that you see.

Note that jira has the ability to mark issues as duplicates. It's on  
the left navigation bar called Link this issue to another issue. The  
menu allows you to link issues (I've done it for this issue) so the  
system can track it.

Thanks again,

Craig

On Nov 1, 2007, at 7:12 AM, Ryosuke Iwata (JIRA) wrote:

>
>      [ https://issues.apache.org/jira/browse/OPENJPA-426? 
> page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Ryosuke Iwata resolved OPENJPA-426.
> -----------------------------------
>
>        Resolution: Duplicate
>     Fix Version/s: 1.1.0
>
> I'm very sorry that this issue has been already reported and fixed.  
> I confirmed this is fixed in a nightly build of 1.1.0.
> https://issues.apache.org/jira/browse/OPENJPA-282
>
>
>> Incorrect DEFERRABLE usage with PostgreSQL
>> ------------------------------------------
>>
>>                 Key: OPENJPA-426
>>                 URL: https://issues.apache.org/jira/browse/ 
>> OPENJPA-426
>>             Project: OpenJPA
>>          Issue Type: Bug
>>          Components: sql
>>    Affects Versions: 1.0.0
>>         Environment: PostgreSQL database 8.1.
>>            Reporter: Ryosuke Iwata
>>             Fix For: 1.1.0
>>
>>
>> OpenJPA generates incorrect CREATE TABLE statements with  
>> PostgreSQL, and you will get syntax errors.
>> OpenJPA adds "DEFERRABLE" to unique constraints, probably because  
>> PostgresDictionary sets "true" as "supportsDeferredConstraints",  
>> while PostgreSQL accepts "DEFERRABLE" only with foreign key  
>> constraints.
>> The description of "CREATE TABLE" in the PostgreSQL documents is  
>> so confusing : the syntax description at the top of the page makes  
>> us feel that "DEFERRABLE" can be specified with any table  
>> constraints, but you can find that it says "Only foreign key  
>> constraints currently accept this clause" in the middle of the  
>> page. See:
>> 	http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html
>> As a result of this confusion, SQL statements which OpenJPA  
>> generates result in database errors saying :
>> 	syntax error at or near "DEFERRABLE"
>> An example of generated SQLs is :
>> 	CREATE TABLE PUBLIC.FOO (entityId BIGINT NOT NULL,
>> 	memo TEXT, name VARCHAR(255) NOT NULL,
>> 	entityVersion INTEGER NOT NULL,
>> 	PRIMARY KEY (entityId), UNIQUE (name) DEFERRABLE);
>> As a workaround, you can add the following line in the  
>> persistence.xml to avoid this problem:
>> 	<property name="openjpa.jdbc.DBDictionary" value="postgres 
>> (SupportsDeferredConstraints=false)"/>
>
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!