提交 d920bf31 编写于 作者: H Heikki Linnakangas

Also support event triggers on CREATE PROTOCOL.

We don't particularly care about event triggers on CREATE PROTOCOL as such,
but we were tripping the assertion in EventTriggerCommonSetup(), because
it was being called for CREATE PROTOCOL, even though it was listed as
not supported. It seems to actually work fine, if we just mark it as
suppported, so might as well.

Add a test case, also for the CREATE EXTERNAL TABLE support.
上级 ce76ab94
......@@ -103,7 +103,7 @@ static event_trigger_support_data event_trigger_support[] = {
/* GPDB additions */
{"EXTERNAL TABLE", true},
{"PROTOCOL", false},
{"PROTOCOL", true},
{NULL, false}
};
......@@ -953,8 +953,8 @@ EventTriggerSupportsObjectType(ObjectType obtype)
/* GPDB additions */
case OBJECT_EXTTABLE:
return true;
case OBJECT_EXTPROTOCOL:
return true;
case OBJECT_RESQUEUE:
case OBJECT_RESGROUP:
return false;
......
create or replace function test_event_trigger() returns event_trigger as $$
BEGIN
RAISE NOTICE 'test_event_trigger: % %', tg_event, tg_tag;
END
$$ language plpgsql;
create event trigger regress_event_trigger on ddl_command_start
execute procedure test_event_trigger();
-- Test event triggers on GPDB specific objects
CREATE EXTERNAL WEB TABLE echotest (x text) EXECUTE 'echo foo;' FORMAT 'text';
NOTICE: test_event_trigger: ddl_command_start CREATE EXTERNAL TABLE
DROP EXTERNAL TABLE echotest;
NOTICE: test_event_trigger: ddl_command_start DROP EXTERNAL TABLE
CREATE OR REPLACE FUNCTION write_to_file() RETURNS integer as '$libdir/gpextprotocol.so', 'demoprot_export' LANGUAGE C STABLE NO SQL;
NOTICE: test_event_trigger: ddl_command_start CREATE FUNCTION
CREATE OR REPLACE FUNCTION read_from_file() RETURNS integer as '$libdir/gpextprotocol.so', 'demoprot_import' LANGUAGE C STABLE NO SQL;
NOTICE: test_event_trigger: ddl_command_start CREATE FUNCTION
CREATE PROTOCOL demoprot_event_trig_test (readfunc = 'read_from_file', writefunc = 'write_to_file');
NOTICE: test_event_trigger: ddl_command_start CREATE PROTOCOL
DROP PROTOCOL demoprot_event_trig_test;
NOTICE: test_event_trigger: ddl_command_start DROP PROTOCOL
drop event trigger regress_event_trigger;
......@@ -34,6 +34,9 @@ test: indexjoin as_alias regex_gp gpparams with_clause transient_types gp_rules
# dispatch should always run seperately from other cases.
test: dispatch
# event triggers cannot run concurrently with any test that runs DDL
test: event_trigger_gp
# test partially distributed tables
test: partial_table
......
create or replace function test_event_trigger() returns event_trigger as $$
BEGIN
RAISE NOTICE 'test_event_trigger: % %', tg_event, tg_tag;
END
$$ language plpgsql;
create event trigger regress_event_trigger on ddl_command_start
execute procedure test_event_trigger();
-- Test event triggers on GPDB specific objects
CREATE EXTERNAL WEB TABLE echotest (x text) EXECUTE 'echo foo;' FORMAT 'text';
DROP EXTERNAL TABLE echotest;
CREATE OR REPLACE FUNCTION write_to_file() RETURNS integer as '$libdir/gpextprotocol.so', 'demoprot_export' LANGUAGE C STABLE NO SQL;
CREATE OR REPLACE FUNCTION read_from_file() RETURNS integer as '$libdir/gpextprotocol.so', 'demoprot_import' LANGUAGE C STABLE NO SQL;
CREATE PROTOCOL demoprot_event_trig_test (readfunc = 'read_from_file', writefunc = 'write_to_file');
DROP PROTOCOL demoprot_event_trig_test;
drop event trigger regress_event_trigger;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册