[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1994) Problem with case sensitive column and tables names and Identity mapping with postgreSQL

Strong Liu (JIRA) noreply at atlassian.com
Mon Jun 6 03:26:25 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42481#action_42481 ] 

Strong Liu commented on HHH-1994:
---------------------------------

test case, please

> Problem with case sensitive column and tables names and Identity mapping with postgreSQL
> ----------------------------------------------------------------------------------------
>
>                 Key: HHH-1994
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1994
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1.3
>         Environment: Hibernate 3.1.3, Java 1.5.0_07 (sun) windos and linux ( 32 & 64 bit). POstgres SQL 8.1 Windows and linux
>            Reporter: Alex Samad
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Whilst trying to insert into a table with a primary key (ID mapping) which has a identity generator. And the columns and/or the table has been defined with case sensitivey ie back ticks.
> It fails to get the next serial number and thus fails any inserts.
> The problem lies in dialect/PostgreSQLDialect.java
>         public String getIdentitySelectString(String table, String column, int type) {
>                 return new StringBuffer().append("select currval('")
>                         .append(table)
>                         .append('_')
>                         .append(column)
>                         .append("_seq')")
>                         .toString();
>         }
> table is inclosed in quotes and column is inclosed in quotes which gives a name like
> "table"_"Column"_seq - which fails
> I would suggest a fix is to test each of table or column for " and if it exist then to strip it of both of table and column and encluse the whole name in "".  This mighe break some old code where say the table is coded in case insensitive table name and case sensitive column key.
> Sorry not much of a java programmer.

-- 
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