[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2428) PostgreSQL 8 serial sequence name for long table names (and columns) does not use standard format

Andrew Wheeler (JIRA) noreply at atlassian.com
Thu Feb 15 16:03:42 EST 2007


PostgreSQL 8 serial sequence name for long table names (and columns) does not use standard format
-------------------------------------------------------------------------------------------------

         Key: HHH-2428
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2428
     Project: Hibernate3
        Type: Bug

    Versions: 3.2.0.ga    
 Environment: PostgresSQL 8.1, Windows
    Reporter: Andrew Wheeler
    Priority: Minor


Tables with serial columns where the both the table and the column are long do not conform to the standard sequence format of [table]_[column]_seq

CREATE TABLE incident_property_relationship
(
  incident_property_relationship_id int4 NOT NULL DEFAULT nextval('incident_property_relationshi_incident_property_relationshi_seq'::regclass),
.
.
}

This table was created using the statement:

create table incident_property_relationship {
     incident_property_relationship_id serial not null,
     .
     .
}


I have fixed the issue by creating a new dialect for postgreSQL (PostgreSQL8Dialect) and changed the function getIdentitySelectString to:

	public String getIdentitySelectString(String table, String column, int type) {
		return new StringBuffer().append("select currval(pg_get_serial_sequence('")
			.append(table)
			.append("','")
			.append(column)
			.append("'))")
			.toString();
	}

This should also work where the serial column has a custom sequence generator.

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