@ -11653,11 +11653,15 @@ CreateTrigStmt:
|
|||||||
{
|
{
|
||||||
if ($2 != false)
|
if ($2 != false)
|
||||||
{
|
{
|
||||||
parser_yyerror("syntax error found");
|
ereport(errstate,
|
||||||
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
|
errmsg("syntax error.")));
|
||||||
}
|
}
|
||||||
if ($3 != NULL)
|
if ($3 != NULL)
|
||||||
{
|
{
|
||||||
parser_yyerror("only support definer in B compatibility database and B syntax");
|
ereport(errstate,
|
||||||
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
|
errmsg("only support definer in B compatibility database and B syntax")));
|
||||||
}
|
}
|
||||||
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
||||||
n->definer = $3;
|
n->definer = $3;
|
||||||
@ -11719,15 +11723,20 @@ CreateTrigStmt:
|
|||||||
u_sess->parser_cxt.isCreateFuncOrProc = true;
|
u_sess->parser_cxt.isCreateFuncOrProc = true;
|
||||||
} subprogram_body
|
} subprogram_body
|
||||||
{
|
{
|
||||||
if (u_sess->attr.attr_sql.sql_compatibility != B_FORMAT || $2 != false)
|
|
||||||
{
|
|
||||||
parser_yyerror("only support definer, trigger_order, subprogram_body in B compatibility database");
|
|
||||||
}
|
|
||||||
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
|
||||||
if ($2 != false)
|
if ($2 != false)
|
||||||
{
|
{
|
||||||
parser_yyerror("syntax error found");
|
ereport(errstate,
|
||||||
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
|
errmsg("syntax error.")));
|
||||||
}
|
}
|
||||||
|
if (u_sess->attr.attr_sql.sql_compatibility != B_FORMAT)
|
||||||
|
{
|
||||||
|
ereport(errstate,
|
||||||
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
|
errmsg("Current syntax is supported only in B compatibility database")));
|
||||||
|
}
|
||||||
|
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
||||||
|
|
||||||
n->definer = $3;
|
n->definer = $3;
|
||||||
n->if_not_exists = false;
|
n->if_not_exists = false;
|
||||||
n->schemaname = $5->schemaname;
|
n->schemaname = $5->schemaname;
|
||||||
@ -11758,15 +11767,20 @@ CreateTrigStmt:
|
|||||||
u_sess->parser_cxt.isCreateFuncOrProc = true;
|
u_sess->parser_cxt.isCreateFuncOrProc = true;
|
||||||
} subprogram_body
|
} subprogram_body
|
||||||
{
|
{
|
||||||
if (u_sess->attr.attr_sql.sql_compatibility != B_FORMAT)
|
|
||||||
{
|
|
||||||
parser_yyerror("only support definer, if not exists, trigger_order, subprogram_body in B compatibility database");
|
|
||||||
}
|
|
||||||
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
|
||||||
if ($2 != false)
|
if ($2 != false)
|
||||||
{
|
{
|
||||||
parser_yyerror("syntax error");
|
ereport(errstate,
|
||||||
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
|
errmsg("syntax error.")));
|
||||||
}
|
}
|
||||||
|
if (u_sess->attr.attr_sql.sql_compatibility != B_FORMAT)
|
||||||
|
{
|
||||||
|
ereport(errstate,
|
||||||
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
|
errmsg("Current syntax is supported only in B compatibility database")));
|
||||||
|
}
|
||||||
|
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
||||||
|
|
||||||
n->definer = $3;
|
n->definer = $3;
|
||||||
n->if_not_exists = true;
|
n->if_not_exists = true;
|
||||||
n->schemaname = $8->schemaname;
|
n->schemaname = $8->schemaname;
|
||||||
|
@ -3,6 +3,28 @@
|
|||||||
drop database if exists db_mysql;
|
drop database if exists db_mysql;
|
||||||
NOTICE: database "db_mysql" does not exist, skipping
|
NOTICE: database "db_mysql" does not exist, skipping
|
||||||
create database db_mysql dbcompatibility 'B';
|
create database db_mysql dbcompatibility 'B';
|
||||||
|
drop database if exists db_td;
|
||||||
|
NOTICE: database "db_td" does not exist, skipping
|
||||||
|
create database db_td dbcompatibility='C';
|
||||||
|
\c db_td
|
||||||
|
create table animals (id int, name char(30));
|
||||||
|
create table food (id int, foodtype varchar(32), remark varchar(32), time_flag timestamp);
|
||||||
|
create trigger animal_trigger1
|
||||||
|
after insert on animals
|
||||||
|
for each row
|
||||||
|
begin
|
||||||
|
insert into food(id, foodtype, remark, time_flag) values (1,'ice cream', 'sdsdsdsd', now());
|
||||||
|
end;
|
||||||
|
/
|
||||||
|
ERROR: Current syntax is supported only in B compatibility database
|
||||||
|
create or replace trigger animal_trigger1
|
||||||
|
after insert on animals
|
||||||
|
for each row
|
||||||
|
begin
|
||||||
|
insert into food(id, foodtype, remark, time_flag) values (1,'ice cream', 'sdsdsdsd', now());
|
||||||
|
end;
|
||||||
|
/
|
||||||
|
ERROR: syntax error.
|
||||||
\c db_mysql
|
\c db_mysql
|
||||||
create table t (id int);
|
create table t (id int);
|
||||||
create table t1 (id int);
|
create table t1 (id int);
|
||||||
@ -49,6 +71,14 @@ begin
|
|||||||
insert into food(id, foodtype, remark, time_flag) values (1,'ice cream', 'sdsdsdsd', now());
|
insert into food(id, foodtype, remark, time_flag) values (1,'ice cream', 'sdsdsdsd', now());
|
||||||
end;
|
end;
|
||||||
/
|
/
|
||||||
|
create or replace trigger animal_trigger1
|
||||||
|
after insert on animals
|
||||||
|
for each row
|
||||||
|
begin
|
||||||
|
insert into food(id, foodtype, remark, time_flag) values (1,'ice cream', 'sdsdsdsd', now());
|
||||||
|
end;
|
||||||
|
/
|
||||||
|
ERROR: syntax error.
|
||||||
--different type trigger follows|precedes
|
--different type trigger follows|precedes
|
||||||
create trigger animal_trigger2
|
create trigger animal_trigger2
|
||||||
before insert on animals
|
before insert on animals
|
||||||
@ -493,6 +523,7 @@ ERROR: drop trigger without table name only support in B-format database
|
|||||||
drop trigger if exists animal_trigger1;
|
drop trigger if exists animal_trigger1;
|
||||||
ERROR: drop trigger without table name only support in B-format database
|
ERROR: drop trigger without table name only support in B-format database
|
||||||
drop database db_mysql;
|
drop database db_mysql;
|
||||||
|
drop database db_td;
|
||||||
-- test declare condition in other compatibility
|
-- test declare condition in other compatibility
|
||||||
create or replace procedure test_condition_1 as
|
create or replace procedure test_condition_1 as
|
||||||
declare
|
declare
|
||||||
|
@ -2,6 +2,28 @@
|
|||||||
-- test mysql compatibility trigger
|
-- test mysql compatibility trigger
|
||||||
drop database if exists db_mysql;
|
drop database if exists db_mysql;
|
||||||
create database db_mysql dbcompatibility 'B';
|
create database db_mysql dbcompatibility 'B';
|
||||||
|
drop database if exists db_td;
|
||||||
|
create database db_td dbcompatibility='C';
|
||||||
|
|
||||||
|
\c db_td
|
||||||
|
create table animals (id int, name char(30));
|
||||||
|
create table food (id int, foodtype varchar(32), remark varchar(32), time_flag timestamp);
|
||||||
|
|
||||||
|
create trigger animal_trigger1
|
||||||
|
after insert on animals
|
||||||
|
for each row
|
||||||
|
begin
|
||||||
|
insert into food(id, foodtype, remark, time_flag) values (1,'ice cream', 'sdsdsdsd', now());
|
||||||
|
end;
|
||||||
|
/
|
||||||
|
|
||||||
|
create or replace trigger animal_trigger1
|
||||||
|
after insert on animals
|
||||||
|
for each row
|
||||||
|
begin
|
||||||
|
insert into food(id, foodtype, remark, time_flag) values (1,'ice cream', 'sdsdsdsd', now());
|
||||||
|
end;
|
||||||
|
/
|
||||||
\c db_mysql
|
\c db_mysql
|
||||||
create table t (id int);
|
create table t (id int);
|
||||||
create table t1 (id int);
|
create table t1 (id int);
|
||||||
@ -49,6 +71,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
/
|
/
|
||||||
|
|
||||||
|
create or replace trigger animal_trigger1
|
||||||
|
after insert on animals
|
||||||
|
for each row
|
||||||
|
begin
|
||||||
|
insert into food(id, foodtype, remark, time_flag) values (1,'ice cream', 'sdsdsdsd', now());
|
||||||
|
end;
|
||||||
|
/
|
||||||
|
|
||||||
--different type trigger follows|precedes
|
--different type trigger follows|precedes
|
||||||
|
|
||||||
create trigger animal_trigger2
|
create trigger animal_trigger2
|
||||||
@ -370,6 +400,7 @@ call test_condition_1();
|
|||||||
drop trigger animal_trigger1;
|
drop trigger animal_trigger1;
|
||||||
drop trigger if exists animal_trigger1;
|
drop trigger if exists animal_trigger1;
|
||||||
drop database db_mysql;
|
drop database db_mysql;
|
||||||
|
drop database db_td;
|
||||||
|
|
||||||
-- test declare condition in other compatibility
|
-- test declare condition in other compatibility
|
||||||
create or replace procedure test_condition_1 as
|
create or replace procedure test_condition_1 as
|
||||||
|
Reference in New Issue
Block a user