You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/10/03 12:52:00 UTC
[jira] [Commented] (AMQ-6826) PostgresqlJDBCAdapter with table
prefix errors when executing createSchemaStatements for creating Indexes.
[ https://issues.apache.org/jira/browse/AMQ-6826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16189670#comment-16189670 ]
ASF GitHub Bot commented on AMQ-6826:
-------------------------------------
GitHub user 1984shekhar opened a pull request:
https://github.com/apache/activemq/pull/260
AMQ-6826
This fix adds the table-prefix to the activemq_acks_pkey. This is because for postgresql if we use table-prefix statement than Indexes are also created using table-prefix. This table-prefix is empty-string if table-prefix is not used so shouldn't affect normal scenario when table-prefix is not used.
{code}
Output from postegre db.
activemq=# \d local_activemq_acks
Table "public.local_activemq_acks"
Column | Type | Modifiers
---------------+------------------------+--------------------
container | character varying(250) | not null
sub_dest | character varying(250) |
client_id | character varying(250) | not null
sub_name | character varying(250) | not null
selector | character varying(250) |
last_acked_id | bigint |
priority | bigint | not null default 5
xid | character varying(250) |
Indexes:
"local_activemq_acks_pkey" PRIMARY KEY, btree (container, client_id, sub_name)
"local_activemq_acks_xidx" btree (xid)
{code}
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/1984shekhar/activemq master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/activemq/pull/260.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #260
----
commit aa72fface4bac3cb799c57eba74e2f6c5aae0fb1
Author: cpandey <cp...@localhost.localdomain>
Date: 2017-10-03T12:41:27Z
AMQ-6826:
PostgresqlJDBCAdapter with table prefix errors when executing
createSchemaStatements for creating Indexes.
commit 783062dab79c89cfdd042e0313742510174a6e6b
Author: cpandey <cp...@localhost.localdomain>
Date: 2017-10-03T12:43:27Z
AMQ-6826 :
PostgresqlJDBCAdapter with table prefix errors when executing
createSchemaStatements for creating Indexes.
----
> PostgresqlJDBCAdapter with table prefix errors when executing createSchemaStatements for creating Indexes.
> ----------------------------------------------------------------------------------------------------------
>
> Key: AMQ-6826
> URL: https://issues.apache.org/jira/browse/AMQ-6826
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker
> Environment: ALL
> Reporter: chandra shekhar pandey
> Priority: Minor
>
> - When using PostgresqlJDBCAdapter to auto create the tables and a table prefix statement is also used the create schema statements fail because PostgresqlJDBCAdapter doesn't add the table prefix to Index:
> {code}
> activemq.xml snippet:
> <bean id="postgresPersistenceAdapter" class="org.apache.activemq.store.jdbc.adapter.PostgresqlJDBCAdapter" />
>
> <persistenceAdapter>
> <jdbcPersistenceAdapter createTablesOnStartup="true" adapter="#postgresPersistenceAdapter" dataSource="#postgres-ds" lockKeepAlivePeriod="5000" >
> <statements>
> <statements tablePrefix="LOCAL_" />
> </statements>
> <locker>
> <lease-database-locker lockAcquireSleepInterval="10000" />
> </locker>
> </jdbcPersistenceAdapter>
> </persistenceAdapter>
> {code}
> - amq log error
> {code}
> 2017-09-28 10:06:40,199 | WARN | AMQ-1-thread-1 | DefaultJDBCAdapter | .jdbc.adapter.DefaultJDBCAdapter 117 | 137 - org.apache.activemq.activemq-osgi - 5.11.0.redhat-621169 | Could not create JDBC tables; they could already exist. Failure was: ALTER TABLE LOCAL_ACTIVEMQ_ACKS DROP CONSTRAINT "activemq_acks_pkey" Message: ERROR: constraint "activemq_acks_pkey" of relation "local_activemq_acks" does not exist SQLState: 42704 Vendor code: 0
> 2017-09-28 10:06:40,200 | WARN | AMQ-1-thread-1 | JDBCPersistenceAdapter | tore.jdbc.JDBCPersistenceAdapter 601 | 137 - org.apache.activemq.activemq-osgi - 5.11.0.redhat-621169 | Failure details: ERROR: constraint "activemq_acks_pkey" of relation "local_activemq_acks" does not exist
> org.postgresql.util.PSQLException: ERROR: constraint "activemq_acks_pkey" of relation "local_activemq_acks" does not exist
> at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477)[172:org.postgresql.jdbc42:42.1.4]
> at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190)[172:org.postgresql.jdbc42:42.1.4]
> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)[172:org.postgresql.jdbc42:42.1.4]
> at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)[172:org.postgresql.jdbc42:42.1.4]
> at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)[172:org.postgresql.jdbc42:42.1.4]
> at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:301)[172:org.postgresql.jdbc42:42.1.4]
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)