Regression: inline comment of SP parameter with closing parenthesis leads to
incorrect SQL when trying to extract metadata
--------------------------------------------------------------------------------------------------------------------------
Key: CORE-6527
URL: http://tracker.firebirdsql.org/browse/CORE-6527
Project: Firebird Core
Issue Type: Bug
Components: Engine, ISQL
Reporter: Pavel Zotov
Consider script and note on inline comment for 2nd input arg: "-- (for
invoices)":
=====
shell if exist c:\temp\tmp4test.fdb del c:\temp\tmp4test.fdb;
create database 'localhost:c:\temp\tmp4test.fdb';
set term ^;
create or alter procedure sp_foo(
a_base_doc_id int,
a_base_doc_oper_id int default null -- (for invoices)
)
as
declare v_info varchar(100);
begin
v_info = 'base_doc='||a_base_doc_id;
end
^
set term ;^
commit;
show version;
=====
If we then extract metadata from this DB then:
1) on 4.0.0.2353 generated SQL will be OK:
=====
/* Stored procedures headers */
CREATE OR ALTER PROCEDURE SP_FOO (A_BASE_DOC_ID INTEGER,
A_BASE_DOC_OPER_ID INTEGER default null)
AS
BEGIN EXIT; END ^
. . .
ALTER PROCEDURE SP_FOO (A_BASE_DOC_ID INTEGER,
A_BASE_DOC_OPER_ID INTEGER default null)
AS
declare v_info varchar(100);
begin
v_info = 'base_doc='||a_base_doc_id;
end ^
=====
(OK; though we do not see any original comments to input parameters, but this
code can be compiled)
2) on 4.0.0.2365 extracted SQL for metadata will be incorrect:
=====
CREATE OR ALTER PROCEDURE SP_FOO (A_BASE_DOC_ID INTEGER,
A_BASE_DOC_OPER_ID INTEGER default null -- (for invoices))
AS
BEGIN EXIT; END ^
. . .
ALTER PROCEDURE SP_FOO (A_BASE_DOC_ID INTEGER,
A_BASE_DOC_OPER_ID INTEGER default null -- (for invoices))
AS
declare v_info varchar(100);
begin
v_info = 'base_doc='||a_base_doc_id;
end ^
=====
(because inline comment with closing parenthesis is included here and this
parenthesis is commented out, so this code can not be compiled.)
PS
The same for builds 3.0.7.33388 (it generates correct SQL) and 3.0.8.33415
(generated metadata SQL is incorrect with the same problem)
Perhaps, this occurs because of fixes in CORE-6466, dated 04-feb-2021:
https://github.com/FirebirdSQL/firebird/commit/a8e63099fced66e6e17333a269435c6f54d87983
and
https://github.com/FirebirdSQL/firebird/commit/32e74743f84d4f37c81ff31d6ae8431f7676cdbd
--
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