Issue Details (XML | Word | Printable)

Key: CORE-5012
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Pavel Zotov
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

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

Created: 12/Nov/15 10:19 AM   Updated: 12/Nov/15 10:19 AM
Component/s: Engine, ISQL
Affects Version/s: 2.5.4
Fix Version/s: None

QA Status: No test


 Description  « Hide
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

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.