Skip to content
Merged
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
8 changes: 4 additions & 4 deletions src/backend/commands/functioncmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1618,11 +1618,11 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
}

/*
* Support Oracle grammar such as
* Support oracle grammer:
* alter function func editionable|noneditionable or compile
* This function does not consider function arguments and
* searches pg_proc directly; if more than one or fewer than one match is
* found, report an error.
* In this function we don't support function arguments or
* searching pg_proc directly, if we found more than one or less
* than one, we report error.
*/
ObjectAddress
CompileFunction(CompileFunctionStmt * stmt)
Expand Down
4 changes: 2 additions & 2 deletions src/backend/oracle_parser/ora_gram.y
Original file line number Diff line number Diff line change
Expand Up @@ -9097,7 +9097,7 @@ implementation_package:
{
$$ = NIL;
}
/* reuse implementation_type temporary */
/* reuse implementation_type temporarily */
| implementation_package_type POLYMORPHIC implementation_type
{
$$ = $3;
Expand Down Expand Up @@ -9195,7 +9195,7 @@ opt_ora_func_args_with_defaults:
* In order to avoid reduce/reduce conflict, we are compatible with Oracle
* based on the original CREATE PROCEUDRE grammar rules of PG. The purpose
* of adding this nonterminal is to try not to destroy the syntax of PG.
* Although we can switch to the gram.y of native PG, try our best to Stick
* Although we can switch to the gram.y of native PG, try our best to stick
* to this principle.
*/
opt_procedure_args_with_defaults:
Expand Down
10 changes: 5 additions & 5 deletions src/include/nodes/parsenodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -4394,21 +4394,21 @@ typedef struct AccessibleByClause
} AccessibleByClause;

/*
* support alter a function like
* support alter a function like:
* alter function func editable|noneditable or compile
* we doesn't use the AlterFunctionStmt, because we doesn't
* we don't use the AlterFunctionStmt, because we don't
* want to use AlterFunction function, which will modify the
* pg_proc catalog table,compile doesn't change the system catalog.
* another reason is AlterFunction which fun should
* another reason is AlterFunction which should
* bring function arguments and find function rely on its
* arguments, this struct will doesn't consider function arguments.
* arguments, this struct will not consider function arguments.
*/
typedef struct CompileFunctionStmt
{
NodeTag type;
ObjectType objtype;
ObjectWithArgs *func; /* name and args of function */
bool is_compile; /* if false, it is change the editable|noneditable */
bool is_compile;
bool editable;
List *parameters;
} CompileFunctionStmt;
Expand Down
2 changes: 1 addition & 1 deletion src/include/pg_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/* Saved arguments from configure */
#undef CONFIGURE_ARGS

/* Define to the default TCP port number on which the server listens and to
/* Define the default TCP port number on which the server listens and to
which clients will try to connect. This can be overridden at run-time, but
it's convenient if your clients have the right default compiled in.
(--with-oraport=PORTNUM) */
Expand Down
2 changes: 1 addition & 1 deletion src/oracle_fe_utils/ora_psqlscan.l
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ is_oracle_slash(PsqlScanState state, const char *line)
len = strlen(line);
for (i = 0; i < len; i++)
{
/* allowed special char */
/* allow special char */
if (line[i] == '\t' ||
line[i] == '\n' ||
line[i] == '\r' ||
Expand Down
6 changes: 3 additions & 3 deletions src/oracle_test/regress/expected/ora_plisql.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--
-- PLISQL
--
-- return is a non-reserved keyword, Can be used as object name.
-- return is a non-reserved keyword, can be used as object name.
CREATE TABLE RETURN (fooid INT, foosubid INT, fooname TEXT);
INSERT INTO RETURN VALUES (1, 2, 'three');
INSERT INTO RETURN VALUES (4, 5, 'six');
Expand Down Expand Up @@ -936,7 +936,7 @@ SELECT pg_get_functiondef('test_subproc_func'::regproc) from dual;
end;
(1 row)

-- ivy_get_plisql_functiondef is only using get plisql func/proc definition.
-- ivy_get_plisql_functiondef is only used to get plisql func/proc definition.
SELECT ivy_get_plisql_functiondef('test_func'::regproc) from dual;
ivy_get_plisql_functiondef
-----------------------------------------------
Expand Down Expand Up @@ -1142,7 +1142,7 @@ EXEC test_proc6(2, 3, 4);
(1 row)

DROP PROCEDURE test_proc6;
-- recursive with output arguments
-- recursion with output arguments
CREATE OR REPLACE PROCEDURE test_proc7(x int, INOUT a int, INOUT b numeric)
AS
BEGIN
Expand Down
6 changes: 3 additions & 3 deletions src/oracle_test/regress/sql/ora_plisql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- PLISQL
--

-- return is a non-reserved keyword, Can be used as object name.
-- return is a non-reserved keyword, can be used as object name.
CREATE TABLE RETURN (fooid INT, foosubid INT, fooname TEXT);
INSERT INTO RETURN VALUES (1, 2, 'three');
INSERT INTO RETURN VALUES (4, 5, 'six');
Expand Down Expand Up @@ -934,7 +934,7 @@ SELECT pg_get_functiondef('test_func'::regproc) from dual;
SELECT pg_get_functiondef('test_proc'::regproc) from dual;
SELECT pg_get_functiondef('test_subproc_func'::regproc) from dual;

-- ivy_get_plisql_functiondef is only using get plisql func/proc definition.
-- ivy_get_plisql_functiondef is only used to get plisql func/proc definition.
SELECT ivy_get_plisql_functiondef('test_func'::regproc) from dual;
SELECT ivy_get_plisql_functiondef('test_proc'::regproc) from dual;
SELECT ivy_get_plisql_functiondef('test_subproc_func'::regproc) from dual;
Expand Down Expand Up @@ -1056,7 +1056,7 @@ END;
CALL test_proc6(2, 3, 4);
EXEC test_proc6(2, 3, 4);
DROP PROCEDURE test_proc6;
-- recursive with output arguments
-- recursion with output arguments

CREATE OR REPLACE PROCEDURE test_proc7(x int, INOUT a int, INOUT b numeric)
AS
Expand Down
56 changes: 27 additions & 29 deletions src/pl/plisql/src/expected/plisql_nested_subproc.out
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ INFO: 529
--print we are in main function
--res = 45 a square function assign 11
--
--there originial not like oracle
--the originial not like oracle
--for out argmuments
do $$
declare
Expand Down Expand Up @@ -447,7 +447,7 @@ begin
end;$$ language plisql;
INFO: 23
INFO: xiexie
-- test subproc function'argument has default value
-- test that subproc function'argument has default value
--test ok
--print 529
do $$
Expand Down Expand Up @@ -788,7 +788,7 @@ begin
end; $$ language plisql;
INFO: text mds2=abc
INFO: 529
---global variable the name as local variable
---global variable has the name as local variable
--test ok
create or replace function test_subproc_func(a in out integer) returns integer AS
$$
Expand Down Expand Up @@ -836,7 +836,7 @@ INFO: 101

drop function test_subproc_func(integer);
set ivorysql.allow_out_parameter_const = false;
--function the name as global variable
--function has the name as global variable
--test failed
do $$
declare
Expand Down Expand Up @@ -890,8 +890,8 @@ end; $$ language plisql;
INFO: var=(1,101)
INFO: var2 = (2,102)
--ok
--this because out parameter we have don't handle
-- so it doesn't like oracle
--this is because we don't handle out parameter,
-- so it is not like oracle
-- test out name=must be assign to null
-- test_out.test_out name=must be assign to null
-- name1= must be assign to null
Expand Down Expand Up @@ -929,7 +929,7 @@ INFO: test out name=must be assign to null
INFO: test_out.test_out name=must be assign to null
INFO: name1=must be assign to null
INFO: declare name=must be assign to null
---schema function and subproc function as the same name
---schema function and subproc function has the same name
create or replace function test_subproc(id integer) returns integer
AS $$
declare
Expand Down Expand Up @@ -990,7 +990,7 @@ drop function test_subproc(integer);
---subproc function return object_type
create type test_subproc_type as (id integer,name varchar(23));
--test ok
--print var1=(23, "a object type")
--print var1=(23, "an object type")
do $$
declare
var1 test_subproc_type;
Expand All @@ -1000,16 +1000,16 @@ declare
var1 test_subproc_type;
begin
var1.id := 23;
var1.name := 'a object type';
var1.name := 'an object type';
return var1;
end;
begin
var1 := test_subproc(23);
raise info 'var1=%', var1;
end;$$ language plisql;
INFO: var1=(23,"a object type")
INFO: var1=(23,"an object type")
--print id = (1, "welcome to beiing")
--print var1=(23, "a object type")
--print var1=(23, "an object type")
do $$
declare
var1 test_subproc_type;
Expand All @@ -1019,7 +1019,7 @@ declare
var1 test_subproc_type;
begin
var1.id := 23;
var1.name := 'a object type';
var1.name := 'an object type';
raise info 'id = %',id;
return var1;
end;
Expand All @@ -1030,7 +1030,7 @@ BEGIN
raise info 'var1=%', var1;
end;$$ language plisql;
INFO: id = (1,"welcome to beiing")
INFO: var1=(23,"a object type")
INFO: var1=(23,"an object type")
drop type test_subproc_type;
--test function and procedure properties
--test ok
Expand Down Expand Up @@ -1967,7 +1967,7 @@ end; $$ language plisql;
ERROR: duplicate declaration at or near ";"
LINE 4: procedure mds(id integer);
^
--only declare but no define raise error
--only declare but no definition, raise error
do $$
DECLARE
var1 integer;
Expand All @@ -1989,7 +1989,7 @@ end; $$ language plisql;
ERROR: A subprogram body must be defined for the forward declaration of mds
LINE 4: function mds(id integer) return integer;
^
--define before declare faield
--define before declare failed
do $$
declare
function mds(id integer) return integer IS
Expand Down Expand Up @@ -2104,9 +2104,9 @@ INFO: proc3
INFO: proc3 out 2
--
--
-- subproc function support polymorphic type
-- subproc function supports polymorphic type
--
--point raise error others is ok
--point raise error, others is ok
do $$
DECLARE
var1 integer;
Expand Down Expand Up @@ -2368,8 +2368,7 @@ BEGIN
raise info '%,%',duplic(int4range(42,49), NULL,NULL),duplic(int4range('23', '45'), NULL,NULL);
end; $$ language plisql;
INFO: (42,"{42,49}"),(23,"{23,45}")
--test extral
--error test_f is is out of scope
--error test_f is out of scope
do $$
declare
var1 integer;
Expand Down Expand Up @@ -2506,7 +2505,7 @@ begin
end; $$ language plisql;
INFO: var1=23
INFO: var1 = 24
--oracle raise error,but we success
--oracle raise error,but we succeed
do $$
declare
var1 integer;
Expand All @@ -2531,7 +2530,7 @@ declare
begin
var1 := test_f(23);
end; $$ language plisql;
--oracle raiser error,but we sucess
--oracle raiser error,but we succeed
create or replace function test_f(id integer) returns integer as
$$
declare
Expand Down Expand Up @@ -2735,7 +2734,7 @@ declare
begin
var1 := test_f();
end;$$ language plisql;
--dynamic include subproc function ok var1=25
--dynamically include subproc function ok var1=25
do $$
declare
var1 integer;
Expand Down Expand Up @@ -2898,7 +2897,7 @@ end; $$ language plisql;
ERROR: Only schema-level programs allow AUTHID at or near "definer"
LINE 4: procedure test_p(id integer) authid definer;
^
--oracle failed, but we sucess
--oracle failed, but we succeed
do $$
declare
var1 integer;
Expand Down Expand Up @@ -2951,7 +2950,7 @@ LINE 1: var1 := test_proc1(23)
HINT: To call a procedure, use CALL.
QUERY: var1 := test_proc1(23)
CONTEXT: PL/iSQL function inline_code_block line 11 at assignment
--surcess
--success
do $$
declare
var1 integer;
Expand Down Expand Up @@ -2985,7 +2984,7 @@ LINE 1: CALL test_func1(var1)
HINT: To call a function, use SELECT.
QUERY: CALL test_func1(var1)
CONTEXT: PL/iSQL function inline_code_block line 9 at CALL
--sucess
--success
do $$
declare
var1 integer;
Expand Down Expand Up @@ -3027,7 +3026,7 @@ declare
BEGIN
trigger := 1;
end; $$ language plisql;
--oracle failed,but we sucess
--oracle failed,but we succeed
do $$
DECLARE
type integer;
Expand All @@ -3049,7 +3048,7 @@ begin
end; $$ language plisql;
INFO: test_f
INFO: test_f
--oracle failed,but we success
--oracle failed,but we succeed
do $$
declare
var1 integer;
Expand Down Expand Up @@ -3232,7 +3231,6 @@ INFO: test_event_trigger: ddl_command_start CREATE TABLE
DROP event TRIGGER regress_event_trigger;
DROP FUNCTION test_event_trigger();
drop table test_subproc_system;
--requite documents example
--ok and print test_subprocproc and test_linefunc
do $$
declare
Expand Down Expand Up @@ -3705,7 +3703,7 @@ declare
end; $$ language plisql;
INFO: 24
INFO: 25.1
--oracle raise error,but we sucess
--oracle raise error,but we succeed
CREATE TABLE mds(id integer,name varchar2(256));
ERROR: relation "mds" already exists
do $$
Expand Down
Loading