You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inline comment ("-- ...") in a view DDL can lead to problem with compiling database metadata that is extracted later by ISQL -X (2.5 only) [CORE5012]
#5300
set term ^;
execute block as begin
execute statement 'create or alter view v_foo as select 1 id from rdb$database where 1=1 -- and 2=2' ;
end
^
set term ;^
commit;
create or alter view v_bar as select 2 id from rdb$database where 1=1 -- and 2=2
-- ... plus very clever comment after the last line of query
-- but before semicolon, so it should be saved in our database.
;
commit;
/* CREATE DATABASE '/3255:e25' PAGE_SIZE 4096 DEFAULT CHARACTER SET NONE */
/* View: V_FOO, Owner: SYSDBA */
CREATE VIEW V_FOO (ID) AS
select 1 id from rdb$database where 1=1 -- and 2=2;
/* View: V_BAR, Owner: SYSDBA */
CREATE VIEW V_BAR (ID) AS
select 2 id from rdb$database where 1=1 -- and 2=2
-- ... plus very clever comment after the last line of query
-- but before semicolon, so it should be saved in our database.
;
Extracted metadata can NOT be compiled: note that semicolon after 1st view (V_FOO) is included in the inlined comment that was injected to view DDL in ES expression. Two views in fact have no separator between their DDL.
Good news is that any comment before final ";" APPEARS in extracted metadata script. This is not so in FB 3.0 but - IMO - this should be another ticket.
Submitted by: @pavel-zotov
Test:
set term ^;
execute block as begin
execute statement 'create or alter view v_foo as select 1 id from rdb$database where 1=1 -- and 2=2' ;
end
^
set term ;^
commit;
create or alter view v_bar as select 2 id from rdb$database where 1=1 -- and 2=2
-- ... plus very clever comment after the last line of query
-- but before semicolon, so it should be saved in our database.
;
commit;
Run:
C:\MIX\firebird\fb25\bin\isql /3255:e25 -i createview.sql & C:\MIX\firebird\fb25\bin\isql /3255:e25 -x 1>createview_25.log
Output:
SET SQL DIALECT 3;
/* CREATE DATABASE '/3255:e25' PAGE_SIZE 4096 DEFAULT CHARACTER SET NONE */
/* View: V_FOO, Owner: SYSDBA */
CREATE VIEW V_FOO (ID) AS
select 1 id from rdb$database where 1=1 -- and 2=2;
/* View: V_BAR, Owner: SYSDBA */
CREATE VIEW V_BAR (ID) AS
select 2 id from rdb$database where 1=1 -- and 2=2
-- ... plus very clever comment after the last line of query
-- but before semicolon, so it should be saved in our database.
;
Extracted metadata can NOT be compiled: note that semicolon after 1st view (V_FOO) is included in the inlined comment that was injected to view DDL in ES expression. Two views in fact have no separator between their DDL.
Good news is that any comment before final ";" APPEARS in extracted metadata script. This is not so in FB 3.0 but - IMO - this should be another ticket.
PS.
ISQL Version: WI-V2.5.5.26952 Firebird 2.5
Server version:
WI-V2.5.5.26952 Firebird 2.5
WI-V2.5.5.26952 Firebird 2.5/tcp (csprog)/P12
WI-V2.5.5.26952 Firebird 2.5/tcp (csprog)/P12
The text was updated successfully, but these errors were encountered: