modify CreateTrigStmt for copy and equal funcs
This commit is contained in:
@ -6271,6 +6271,8 @@ static CreateTrigStmt* _copyCreateTrigStmt(const CreateTrigStmt* from)
|
||||
COPY_SCALAR_FIELD(if_not_exists);
|
||||
COPY_STRING_FIELD(trgordername);
|
||||
COPY_SCALAR_FIELD(is_follows);
|
||||
COPY_STRING_FIELD(schemaname);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
|
||||
@ -2280,6 +2280,7 @@ static bool _equalCreateTrigStmt(const CreateTrigStmt* a, const CreateTrigStmt*
|
||||
COMPARE_SCALAR_FIELD(if_not_exists);
|
||||
COMPARE_STRING_FIELD(trgordername);
|
||||
COMPARE_SCALAR_FIELD(is_follows);
|
||||
COMPARE_STRING_FIELD(schemaname);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1454,9 +1454,10 @@ ObjectAddress renametrig(RenameStmt* stmt)
|
||||
/* Have lock already, so just need to build relcache entry. */
|
||||
targetrel = relation_open(relid, NoLock);
|
||||
|
||||
if (PointerIsValid(stmt->renameTargetList) && PointerIsValid(stmt->renameTargetList->head)) {
|
||||
if (u_sess->attr.attr_sql.sql_compatibility == B_FORMAT &&
|
||||
PointerIsValid(stmt->renameTargetList) && PointerIsValid(stmt->renameTargetList->head)) {
|
||||
RangeVar* trigname = (RangeVar*)lfirst(list_head(stmt->renameTargetList));
|
||||
if (u_sess->attr.attr_sql.sql_compatibility == B_FORMAT && trigname->schemaname != NULL) {
|
||||
if (trigname->schemaname != NULL) {
|
||||
Oid relNamespaceId = RelationGetNamespace(targetrel);
|
||||
if (relNamespaceId != get_namespace_oid(trigname->schemaname, false)) {
|
||||
ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
|
||||
@ -980,7 +980,7 @@ ERROR: trigger "animals_trigger2_2" for relation "animals_scm" already exists
|
||||
alter trigger testscm_no.animals_trigger2_2 on testscm.animals_scm rename to animals_trigger2_3;
|
||||
ERROR: schema "testscm_no" does not exist
|
||||
drop trigger testscm.animals_trigger2_2 on testscm.animals_scm;
|
||||
-- 1.6 set search_path to schema
|
||||
-- 1.4 set search_path to schema
|
||||
set search_path to testscm;
|
||||
create trigger animals_trigger2
|
||||
after insert on animals_scm
|
||||
|
||||
@ -91,7 +91,6 @@ delete from testscm.food_scm;
|
||||
drop trigger animals_trigger3;
|
||||
drop trigger animals_trigger3;
|
||||
select tgname from pg_trigger;
|
||||
|
||||
-- 1.1.1.2 trigger with right schema
|
||||
create trigger testscm.animals_trigger2
|
||||
after insert on testscm.animals_scm
|
||||
@ -547,7 +546,7 @@ select tgname from pg_trigger;
|
||||
alter trigger testscm.animals_trigger2_1 on testscm.animals_scm rename to animals_trigger2_2;
|
||||
alter trigger testscm_no.animals_trigger2_2 on testscm.animals_scm rename to animals_trigger2_3;
|
||||
drop trigger testscm.animals_trigger2_2 on testscm.animals_scm;
|
||||
-- 1.6 set search_path to schema
|
||||
-- 1.4 set search_path to schema
|
||||
set search_path to testscm;
|
||||
create trigger animals_trigger2
|
||||
after insert on animals_scm
|
||||
|
||||
Reference in New Issue
Block a user