FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.23k stars 213 forks source link

AUTODDL OFF: can`t create procedure P2 which references on proc P1 and both of them are created in same transaction (and ONLY at 2nd, 4th, 6th etc even runs of the script) [CORE4490] #4810

Open firebird-automations opened 10 years ago

firebird-automations commented 10 years ago

Submitted by: @pavel-zotov

LI-V2.5.3.26744

1. Create new database:

SQL> create database 'test25.fdb'; commit; SQL> connect 'localhost/3253:/var/db/fb25/test25.fdb'; Database: 'localhost/3253:/var/db/fb25/test25.fdb'

2. Run *several* times the following script ('crp.sql'):

set autoddl off; commit;

set term ^; create or alter procedure p1 returns (result int) as begin result = 1; suspend; end ^

create or alter procedure p2 returns (result int) as begin result = (select result from p1); suspend; end ^

set term ;^ rollback; --- end of script 'crp.sql' ---

The output in ISQL is:

SQL> in crp.sql; SQL> show proc; There are no stored procedures in this database -- Ok -- --- Now run this script AGAIN in the same connection:

SQL> in crp.sql; Statement failed, SQLSTATE = 42000 unsuccessful metadata update -Procedure P1 not found After line 4 in file crp.sql Statement failed, SQLSTATE = 42S02 Dynamic SQL Error -SQL error code = -204 -Table unknown -P1 -At line 3, column 34 At line 13 in file crp.sql SQL>

--- So, 2nd run faults. -- Now try it one again, 3rd run:

SQL> in crp.sql; SQL> show proc; There are no stored procedures in this database --- Ok! ---

-- And now - once more, 4th time: SQL> in crp.sql; Statement failed, SQLSTATE = 42000 unsuccessful metadata update -Procedure P1 not found After line 4 in file crp.sql Statement failed, SQLSTATE = 42S02 Dynamic SQL Error -SQL error code = -204 -Table unknown -P1 -At line 3, column 34 At line 13 in file crp.sql

--- So, 4th run *faults* - as 2nd.

All odd runs (1,3,5,...) of this script finishes Ok and even ones (2,4,6,...) faults.

PS. No such problem in LI-T3.0.0.31208

firebird-automations commented 10 years ago

Commented by: @asfernandes

I don't believe this is going to be easily fixable in 2.5...