Subject | ALTER INDEX causes "attempt to store duplicate value" @L |
---|---|
Author | Alec Swan |
Post date | 2010-02-09T21:42:42Z |
I posted the following message about a week ago and have not received
any response. Does anybody know what's happening here? Should I avoid
using "ALTER INDEX" and instead just use "SET STATISTICS" to avoid
this problem?
Thanks.
I created a maintenance plan for my Firebird 2.1.2 database. The
maintenance plan executes a statement which updates all indexes using
"ALTER INDEX" statement, which throws the exception shown below. The
violated index has been in the database forever.
Can anybody explain why this is happening?
Failed to rebuild indexes in EXECUTE BLOCK AS
DECLARE VARIABLE stmt VARCHAR(1000);
BEGIN
for select 'ALTER INDEX "'||rdb$index_name ||'" ACTIVE;'
from rdb$indices
where rdb$system_flag is not null and rdb$system_flag = 0
into :stmt
do EXECUTE STATEMENT :stmt;
END;
Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception.
335544349. attempt to store duplicate value (visible to active
transactions) in unique index "IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
Reason: attempt to store duplicate value (visible to active
transactions) in unique index "IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544349. attempt
to store duplicate value (visible to active transactions) in unique
index "IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
Reason: attempt to store duplicate value (visible to active
transactions) in unique index "IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
org.firebirdsql.gds.GDSException: attempt to store duplicate value
(visible to active transactions) in unique index
"IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
at org.firebirdsql.gds.impl.jni.JniGDSImpl.native_isc_commit_transaction(Native
Method)
at org.firebirdsql.gds.impl.jni.BaseGDSImpl.iscCommitTransaction(BaseGDSImpl.java:202)
at org.firebirdsql.gds.impl.GDSHelper.commitTransaction(GDSHelper.java:604)
at org.firebirdsql.jca.FBManagedConnection.internalCommit(FBManagedConnection.java:599)
at org.firebirdsql.jca.FBLocalTransaction.internalCommit(FBLocalTransaction.java:193)
at org.firebirdsql.jca.FBLocalTransaction.commit(FBLocalTransaction.java:167)
at org.firebirdsql.jdbc.InternalTransactionCoordinator$AutoCommitCoordinator.statementCompleted(InternalTransactionCoordinator.java:248)
at org.firebirdsql.jdbc.InternalTransactionCoordinator.statementCompleted(InternalTransactionCoordinator.java:55)
at org.firebirdsql.jdbc.AbstractStatement.notifyStatementCompleted(AbstractStatement.java:246)
at org.firebirdsql.jdbc.AbstractStatement.notifyStatementCompleted(AbstractStatement.java:241)
at org.firebirdsql.jdbc.AbstractStatement.execute(AbstractStatement.java:582)
any response. Does anybody know what's happening here? Should I avoid
using "ALTER INDEX" and instead just use "SET STATISTICS" to avoid
this problem?
Thanks.
I created a maintenance plan for my Firebird 2.1.2 database. The
maintenance plan executes a statement which updates all indexes using
"ALTER INDEX" statement, which throws the exception shown below. The
violated index has been in the database forever.
Can anybody explain why this is happening?
Failed to rebuild indexes in EXECUTE BLOCK AS
DECLARE VARIABLE stmt VARCHAR(1000);
BEGIN
for select 'ALTER INDEX "'||rdb$index_name ||'" ACTIVE;'
from rdb$indices
where rdb$system_flag is not null and rdb$system_flag = 0
into :stmt
do EXECUTE STATEMENT :stmt;
END;
Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception.
335544349. attempt to store duplicate value (visible to active
transactions) in unique index "IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
Reason: attempt to store duplicate value (visible to active
transactions) in unique index "IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544349. attempt
to store duplicate value (visible to active transactions) in unique
index "IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
Reason: attempt to store duplicate value (visible to active
transactions) in unique index "IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
org.firebirdsql.gds.GDSException: attempt to store duplicate value
(visible to active transactions) in unique index
"IDX_MK2ruDPOuXCeZtnMo6Hg2Q=="
at org.firebirdsql.gds.impl.jni.JniGDSImpl.native_isc_commit_transaction(Native
Method)
at org.firebirdsql.gds.impl.jni.BaseGDSImpl.iscCommitTransaction(BaseGDSImpl.java:202)
at org.firebirdsql.gds.impl.GDSHelper.commitTransaction(GDSHelper.java:604)
at org.firebirdsql.jca.FBManagedConnection.internalCommit(FBManagedConnection.java:599)
at org.firebirdsql.jca.FBLocalTransaction.internalCommit(FBLocalTransaction.java:193)
at org.firebirdsql.jca.FBLocalTransaction.commit(FBLocalTransaction.java:167)
at org.firebirdsql.jdbc.InternalTransactionCoordinator$AutoCommitCoordinator.statementCompleted(InternalTransactionCoordinator.java:248)
at org.firebirdsql.jdbc.InternalTransactionCoordinator.statementCompleted(InternalTransactionCoordinator.java:55)
at org.firebirdsql.jdbc.AbstractStatement.notifyStatementCompleted(AbstractStatement.java:246)
at org.firebirdsql.jdbc.AbstractStatement.notifyStatementCompleted(AbstractStatement.java:241)
at org.firebirdsql.jdbc.AbstractStatement.execute(AbstractStatement.java:582)