[
https://issues.apache.org/jira/browse/JCR-889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12497992
]
Miguel Angel Jiménez Sampedro commented on JCR-889:
---------------------------------------------------
I have a solution tested extensively in our development environment, so I'm
pretty sure it will work. The solution includes two new classes:
org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager
org.apache.jackrabbit.core.persistence.bundle.util.PostgreSQLNameIndex
And the new ddl file to generate the schema.
The work around to retrieve the generated key in postgres is implemented in
PostgreSQLNameIndex. After doing the insert into <schemaObjectPrefix>NAMES
table, the generated key is retrieved doing a second query on the implicit
sequence that assigns values to the primary key column. It's very similar to
the NGKDbNameIndex class in that same package, but the query is very specific
to PostgreSQL and looks like this:
select currval(<schemaObjectPrefix>NAMES_ID_SEQ')
This is the link to the PostgreSQL documentation on the currval function:
http://www.postgresql.org/docs/8.1/interactive/functions-sequence.html
I have tested it with a PostgreSQL 7.4, 8.0 and 8.1. I am attaching these files
here for you to test, modify and hopefully integrate in the SVN repositories.
As written before, feel free to make any changes in these files.
> Add bundle support for PostgreSQL
> ---------------------------------
>
> Key: JCR-889
> URL: https://issues.apache.org/jira/browse/JCR-889
> Project: Jackrabbit
> Issue Type: New Feature
> Components: core
> Reporter: Miguel Angel Jiménez Sampedro
> Priority: Minor
> Attachments: postgresql.ddl
>
>
> The class DbNameIndex does not work with this RDBMS since the
> RETURN_GENERATED_KEYS JDBC feature is not implemented in current PostgreSQL
> drivers.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.