Inline comment ("-- ...") in a view DDL can lead to problem with compiling 
database metadata that is extracted later by ISQL -X (2.5 only)
------------------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-5012
                 URL: http://tracker.firebirdsql.org/browse/CORE-5012
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine, ISQL
    Affects Versions: 2.5.4
            Reporter: 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to