Skip to content

Comments to SP parameter (typed within SP header declaration) can be lost in metadata extraction script (if parameter is declared *without* DEFAULT or "=" modifier) [CORE6530] #6757

Open
@firebird-automations

Description

@firebird-automations

Submitted by: @pavel-zotov

Attachments:
missed-comments-to-sp-parameters-when-extract-metadata.7z

Consider script:

set bail on;
shell del C:\temp\tmp.fdb 2>nul;
create database 'localhost:C:\temp\tmp.fdb';
set term ^;
create or alter procedure sp_1(
p00 int -- single-line comment for `p00`
,p01 int
/*
multi-line comment
for `p01`,
typed on
several
lines
*/
,p02 int /* multi-line comment for `p02`, typed in one line */
,p03 varchar(1) character set utf8 -- single line comment for `p03` which has `character set` clause
,p04 type of column rdb$database.rdb$relation_id /* multi-line comment for `p04` which has `type of column` clause */
,
p05 int default null -- p05
-- ^^^^^^^
,
p06 int = null /* p06 */
-- ^
) returns (
r01 int -- r01
,r02 char(1) not null /* r02 */
)
as
begin
-- nop --
end
^
set term ;^
commit;

(it can be seen more readable in attached .7z / .png).

If we run 'isql -x' for this DB then extracted metadata SQL will be like this:

SET TERM ^ ;

/* Stored procedures headers */
CREATE OR ALTER PROCEDURE SP_1 (P00 INTEGER,
P01 INTEGER,
P02 INTEGER,
P03 VARCHAR(1) CHARACTER SET UTF8,
P04 TYPE OF COLUMN RDB$DATABASE.RDB$RELATION_ID,
P05 INTEGER default null -- p05
-- ^^^^^^^
,
P06 INTEGER = null /* p06 */
-- ^
)
RETURNS (R01 INTEGER,
R02 CHAR(1) CHARACTER SET NONE NOT NULL)
AS
BEGIN EXIT; END ^

SET TERM ; ^
COMMIT WORK;
SET AUTODDL ON;

COMMIT WORK;
SET AUTODDL OFF;
SET TERM ^ ;

/* Stored procedures bodies */

ALTER PROCEDURE SP_1 (P00 INTEGER,
P01 INTEGER,
P02 INTEGER,
P03 VARCHAR(1) CHARACTER SET UTF8,
P04 TYPE OF COLUMN RDB$DATABASE.RDB$RELATION_ID,
P05 INTEGER default null -- p05
-- ^^^^^^^
,
P06 INTEGER = null /* p06 */
-- ^
)
RETURNS (R01 INTEGER,
R02 CHAR(1) CHARACTER SET NONE NOT NULL)
AS
begin
-- nop --
end ^

SET TERM ; ^

So, comments for any input parameter will be lost if this pareameter was declared WITHOUT 'default' or '=' modifier.
Comments for output parameters will be lost at all.

Checked on:
WI-V4.0.0.2399
WI-V3.0.8.33431

FB 2.5 can not be used here: it does not preserve any comments of this type.

PS.
Priority was set to minor. This "feature" can be considered as inconvenience rather than real bug.

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