FirebirdSQL / firebird

Firebird server, client and tools
https://firebirdsql.org
1.26k stars 217 forks source link

Can't alter field after dropping all dependent triggers (all in one transaction) [CORE3458] #3819

Open firebird-automations opened 13 years ago

firebird-automations commented 13 years ago

Submitted by: Nick (nick)

Is duplicated by CORE5763

test: CREATE TABLE T (F INTEGER);

CREATE TRIGGER T_BI FOR T ACTIVE BEFORE INSERT POSITION 0 AS BEGIN NEW.F = 0; END

COMMIT;

DROP TRIGGER T_BI; ALTER TABLE T ALTER F TO FF -- exception here COMMIT;

Exception text: unsuccessful metadata update Column F from table T is referenced in T_BI This operation is not defined for system tables. Error Code: 31 ------- Tested on FB 2.5.1.26266

firebird-automations commented 7 years ago

Commented by: Nick (nick)

still exists in 3.0.1

firebird-automations commented 7 years ago
Modified by: Nick (nick) Version: 3\.0\.1 \[ 10730 \] Version: 2\.5\.1 \[ 10333 \] =\>
firebird-automations commented 7 years ago

Commented by: @pavel-zotov

I see that you omit 'set term' and semicolon(s). Can you repeat following script in ISQL rather than in IDE ? (of course, replace 'c:\temp', DB name and user/password with your settings)

set bail on; set echo on; shell if exist c:\temp\e30.fdb del /q /f c:\temp\e30.fdb; create database 'localhost:c:\temp\e30.fdb' user sysdba password 'masterkey'; show version;

create table t (f integer);

set term ^; create trigger t_bi for t active before insert position 0 as begin new.f = 0; end ^ set term ;^

commit;

drop trigger t_bi; alter table t alter f to ff; commit;

drop database;

// Checked on WI-V3.0.1.32609 (release 3.0.1) and on fresh 3.0.2 snapshot: no errors.

firebird-automations commented 7 years ago

Commented by: Nick (nick)

With turning ddl autocommit off (set autoddl off) I have:

Statement failed, SQLSTATE = 42000 unsuccessful metadata update -ALTER TABLE T failed -Column F from table T is referenced in T_BI After line 20 in file script.sql

firebird-automations commented 6 years ago
Modified by: @dyemanov Link: This issue is duplicated by [CORE5763](https://github.com/FirebirdSQL/firebird/issues?q=CORE5763+in%3Atitle) \[ [CORE5763](https://github.com/FirebirdSQL/firebird/issues?q=CORE5763+in%3Atitle) \]
firebird-automations commented 6 years ago
Modified by: @dyemanov assignee: Dmitry Yemanov \[ dimitr \]