Subject Re: [firebird-support] Deadlock during Alter Table
Author Dmitry Yemanov
burmair wrote:
>
> SET NAMES UTF8;
>
> SET SQL DIALECT 3;
>
> SET AUTODDL ON;
>
> ALTER TABLE VALUE_BUNDLE DROP CONSTRAINT INTEG_28;
>
> /* Alter Field (Null / Not Null)... */
> UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = 1 WHERE
> RDB$FIELD_NAME='UUID' AND RDB$RELATION_NAME='VALUE_BUNDLE';
>
> /* Alter Field (Null / Not Null)... */
> UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = NULL WHERE
> RDB$FIELD_NAME='FV_UUID' AND RDB$RELATION_NAME='VALUE_BUNDLE';
>
> /* Alter Field (Null / Not Null)... */
> UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = NULL WHERE
> RDB$FIELD_NAME='FV_ROW' AND RDB$RELATION_NAME='VALUE_BUNDLE';

A commit is missing here.

> /* Create Primary Key... */
> ALTER TABLE VALUE_BUNDLE ADD PRIMARY KEY (UUID);
> Statement failed, SQLCODE = -913
> deadlock
> =====================
>
> Can anyone tell me what the problem is here?

ISQL executes DML and DDL in different transactions. Without a commit
above, you have the DML transaction active and possibly conflicting with
the changes done later in the DDL transaction during processing of ALTER.


Dmitry