Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
firebird-automations opened this issue Nov 12, 2015 · 0 comments

Comments

@firebird-automations
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant