SEC-1038: Error in JdbcMutableAclService with Postgres #1289

Closed
spring-issuemaster opened this Issue Nov 25, 2008 · 4 comments

1 participant

@spring-issuemaster

Thomas Champagne (Migrated from SEC-1038) said:

When I use the Spring Security’s ACL services with a Postgres database, I am getting the following error when I call the createAcl method in the JdbcMutableAclService class :
Caused by: org.postgresql.util.PSQLException: ERROR: column “object_id_identity” is of type bigint but expression is of type character varying

The problem is caused in the createObjectIdentity method by object.getIdentifier().toString() because the parameter is a string or the column is a bigint in the database.

To solve the problem, you must cast to long :
protected void createObjectIdentity(ObjectIdentity object, Sid owner) {
Long sidId = createOrRetrieveSidPrimaryKey(owner, true);
Long classId = createOrRetrieveClassPrimaryKey(object.getJavaType(), true);
jdbcTemplate.update(insertObjectIdentity,
new Object[] {classId, new Long(object.getIdentifier().toString()), sidId, new Boolean(true)});
}

There is a thread in the forum about this problem : http://forum.springframework.org/showthread.php?t=56889

Thomas

@spring-issuemaster

Luke Taylor said:

Looking at this, we can probably remove the toString() altogether and just use object.getIdentifier(). This should be the appropriate type for the schema (i.e. a Long in this case).

@spring-issuemaster

Luke Taylor said:

I've modified the code to use the identifier explicitly and run the tests against a Postgres database. Also updated the schema appendix in the reference manual to include information on Postgres.

@spring-issuemaster

Thomas Champagne said:

I tested your patch in the current stable release (2.0.4) and it works fine.
Thanks for your help.

@spring-issuemaster

Luke Taylor said:

Thanks for the feedback, Thomas. Closing the issue.

@spring-issuemaster spring-issuemaster added this to the 3.0.0 M1 milestone Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment