Skip to content

Make 'ISQL -X' smarter when extracted metadata contains SP w/o RETURNS but with SUSPEND clause (FB4.x+) #8587

Open
@pavel-zotov

Description

@pavel-zotov
  1. Run this script on FB 3.x (it will finish w/o errors):
shell if exist r:\temp\tmp4test.fdb del r:\temp\tmp4test.fdb;
create database 'localhost:r:\temp\tmp4test.fdb';

set term ^;
create procedure sp_test as
begin
    suspend;
end
^
commit
^
  1. Make backup using FB 3.x and then restore using FB 4.x or 5.x (let target DB name is: r:\temp\tmp4test.fb5x.fdb)
  2. Run %FB5_HOME%\isql.exe -x r:\temp\tmp4test.fb5x.fdb
  3. Script will be like this:
SET SQL DIALECT 3; 

/* CREATE DATABASE 'localhost:r:\temp\tmp4test.fb5x.fdb' PAGE_SIZE 8192 DEFAULT CHARACTER SET NONE; */
COMMIT WORK;
COMMIT WORK;
SET AUTODDL OFF;
SET TERM ^ ;

/* Stored procedures headers */
CREATE OR ALTER PROCEDURE SP_TEST AS 
BEGIN SUSPEND; END ^

SET TERM ; ^
COMMIT WORK;
SET AUTODDL ON;
COMMIT WORK;
SET AUTODDL OFF;
SET TERM ^ ;

/* Stored procedures bodies */
ALTER PROCEDURE SP_TEST AS 
begin
    suspend;
end ^
SET TERM ; ^
COMMIT WORK;
SET AUTODDL ON;
  1. Open extracted metadata script, uncomment create database
  2. Remove r:\temp\tmp4test.fb5x.fdb
  3. Try to apply extracted metadata.
  4. Error will raise:
/* Stored procedures headers */
CREATE OR ALTER PROCEDURE SP_TEST AS 
BEGIN SUSPEND; END ^
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE OR ALTER PROCEDURE SP_TEST failed
-Dynamic SQL Error
-SQL error code = -104
-SUSPEND could not be used without RETURNS clause in PROCEDURE or EXECUTE BLOCK
After line 11 in file R:\Temp\tmp4test.fb5X.meta.sql

Procedure without output parameters (i.e. w/o RETURNS clause in declaration) must not have SUSPEND according to #6483

It will be useful if isql -x will do smth like "carving" of SUSPEND from header and body of such SP

Otherwise long-time consuming task raises related to writing 'smart parser' of extracted metadata (because SP declaration can either have or have no 'returns' clause at one of its previous lines).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions