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

[CBRD-25672] Stored functions are not allowed as default values ​​for… #2015

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
===================================================
0

===================================================
0

===================================================
0

===================================================
Error:-494
Semantic: before ' ); '
'demo_hello_ret()' function can not be used in DEFAULT clause. create class [dba.col_def_test] ( id integer, def_val varcha...

===================================================
Error:-493
Syntax: before ' VALUES (1), (2); '
Unknown class "dba.col_def_test". insert into [dba.col_def_test] (id) values (1), (2)

===================================================
Error:-493
Syntax: before ' ; '
Unknown class "dba.col_def_test". select * from [dba.col_def_test]

===================================================
0

===================================================
Error:-494
Semantic: before ' ); '
'demo_hello_ret2(1)' function can not be used in DEFAULT clause. create class [dba.col_def_test] ( id integer, def_val varcha...

===================================================
Error:-493
Syntax: before ' VALUES (1), (2); '
Unknown class "dba.col_def_test". insert into [dba.col_def_test] (id) values (1), (2)

===================================================
Error:-493
Syntax: before ' ; '
Unknown class "dba.col_def_test". select * from [dba.col_def_test]

===================================================
Error:-494
Semantic: before '
) AS
BEGIN
DBMS_OUTPUT.put_line(a);
END; '
'demo_hello_ret()' function can not be used in DEFAULT clause. create or replace procedure [dba.test_var](a varchar defaul...

===================================================
Error:-494
Semantic: before '
) AS
BEGIN
DBMS_OUTPUT.put_line(a);
END; '
'demo_hello_ret2(1)' function can not be used in DEFAULT clause. create or replace procedure [dba.test_var](a varchar defaul...

===================================================
0

===================================================
Error:-894
Stored procedure/function 'dba.test_var' does not exist.

===================================================
0

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
--+ server-message on
-- Verified for CBRD-25672
-- error code :
-- Specifying stored functions as default values for tables and stored procedures/functions is not allowed.

create or replace function demo_hello_ret() return varchar as
begin
return 'hello cubrid';
end;

create or replace function demo_hello_ret2(a int) return varchar as
begin
return 'hello cubrid2';
end;

DROP TABLE IF EXISTS col_def_test;

CREATE TABLE col_def_test
(id INT, def_val VARCHAR DEFAULT demo_hello_ret());

INSERT INTO col_def_test (id) VALUES (1), (2);

SELECT * FROM col_def_test;

DROP TABLE IF EXISTS col_def_test;

CREATE TABLE col_def_test
(id INT, def_val VARCHAR DEFAULT demo_hello_ret2(1));

INSERT INTO col_def_test (id) VALUES (1), (2);

SELECT * FROM col_def_test;

CREATE OR REPLACE PROCEDURE test_var (
a VARCHAR DEFAULT demo_hello_ret()
) AS
BEGIN
DBMS_OUTPUT.put_line(a);
END;

CREATE OR REPLACE PROCEDURE test_var (
a VARCHAR DEFAULT demo_hello_ret2(1)
) AS
BEGIN
DBMS_OUTPUT.put_line(a);
END;

drop function demo_hello_ret, demo_hello_ret2;
drop procedure test_var;

drop table if exists col_def_test;

--+ server-message off