From d8af13d896d6a4fc5464160b4e083ae583cfb310 Mon Sep 17 00:00:00 2001 From: Petr Jelinek Date: Wed, 11 Feb 2015 16:02:44 +0100 Subject: [PATCH] deparse-test: add deparse_schedule to regression tests --- src/test/regress/GNUmakefile | 4 + src/test/regress/deparse_schedule | 151 +++++++++++++++++++++ src/test/regress/expected/deparse_init.out | 18 ++- src/test/regress/sql/deparse_dump.sql | 1 + src/test/regress/sql/deparse_init.sql | 22 +++ 5 files changed, 190 insertions(+), 6 deletions(-) create mode 100644 src/test/regress/deparse_schedule create mode 100644 src/test/regress/sql/deparse_dump.sql create mode 100644 src/test/regress/sql/deparse_init.sql diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index b40b37c0b7..0bc3907179 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -160,6 +160,10 @@ installcheck-tests: all tablespace-setup standbycheck: all $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/standby_schedule --use-existing +deparsetest: all tablespace-setup + $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/deparse_schedule $(TEMP_CONF) $(EXTRA_TESTS) + + # old interfaces follow... runcheck: check diff --git a/src/test/regress/deparse_schedule b/src/test/regress/deparse_schedule new file mode 100644 index 0000000000..8fad12a6dc --- /dev/null +++ b/src/test/regress/deparse_schedule @@ -0,0 +1,151 @@ +# src/test/regress/serial_schedule +# This should probably be in an order similar to parallel_schedule. +test: deparse_init +test: tablespace +test: boolean +test: char +test: name +test: varchar +test: text +test: int2 +test: int4 +test: int8 +test: oid +test: float4 +test: float8 +test: bit +test: numeric +test: txid +test: uuid +test: enum +test: money +test: rangetypes +test: pg_lsn +test: regproc +test: strings +test: numerology +test: point +test: lseg +test: line +test: box +test: path +test: polygon +test: circle +test: date +test: time +test: timetz +test: timestamp +test: timestamptz +test: interval +test: abstime +test: reltime +test: tinterval +test: inet +test: macaddr +test: tstypes +test: comments +test: geometry +test: horology +test: regex +test: oidjoins +test: type_sanity +test: opr_sanity +test: insert +test: create_function_1 +test: create_type +test: create_table +test: create_function_2 +test: copy +test: copyselect +test: create_misc +test: create_operator +test: create_index +test: create_view +test: create_aggregate +test: create_function_3 +test: create_cast +test: constraints +test: triggers +test: inherit +test: create_table_like +test: typed_table +test: vacuum +test: drop_if_exists +test: updatable_views +test: sanity_check +test: errors +test: select +test: select_into +test: select_distinct +test: select_distinct_on +test: select_implicit +test: select_having +test: subselect +test: union +test: case +test: join +test: aggregates +test: transactions +ignore: random +test: random +test: portals +test: arrays +test: btree_index +test: hash_index +test: update +test: delete +test: namespace +test: prepared_xacts +test: privileges +test: security_label +test: collate +test: matview +test: lock +test: replica_identity +test: rowsecurity +test: alter_generic +test: misc +test: psql +test: async +test: rules +test: event_trigger +test: select_views +test: portals_p2 +test: foreign_key +test: cluster +test: dependency +test: guc +test: bitmapops +test: combocid +test: tsearch +test: tsdicts +test: foreign_data +test: window +test: xmlmap +test: functional_deps +test: advisory_lock +test: json +test: jsonb +test: indirect_toast +test: equivclass +test: plancache +test: limit +test: plpgsql +test: copy2 +test: temp +test: domain +test: rangefuncs +test: prepare +test: without_oid +test: conversion +test: truncate +test: alter_table +test: sequence +test: polymorphism +test: rowtypes +test: returning +test: largeobject +test: with +test: xml +test: stats +test: deparse_dump \ No newline at end of file diff --git a/src/test/regress/expected/deparse_init.out b/src/test/regress/expected/deparse_init.out index 0f306e705a..3046c0ba07 100644 --- a/src/test/regress/expected/deparse_init.out +++ b/src/test/regress/expected/deparse_init.out @@ -1,15 +1,21 @@ -- -- DEPARSE_INIT -- -CREATE TABLE deparse_test_commands ( +CREATE SCHEMA deparse; +CREATE TABLE deparse.deparse_test_commands ( id SERIAL PRIMARY KEY, command TEXT ); -CREATE FUNCTION deparse_test_ddl_command_end() +CREATE FUNCTION deparse.deparse_test_ddl_command_end() RETURNS event_trigger - LANGUAGE C -AS '/space/sda1/ibarwick/2ndquadrant_bdr/src/test/regress/regress.so', 'deparse_test_ddl_command_end'; -/* This should come last - we don't want to log anything defined here */ + LANGUAGE plpgsql +AS $fn$ +BEGIN + INSERT INTO deparse.deparse_test_commands (command) + SELECT pg_event_trigger_expand_command(command) + FROM pg_event_trigger_get_creation_commands(); +END; +$fn$; CREATE EVENT TRIGGER deparse_test_trg_ddl_command_end ON ddl_command_end - EXECUTE PROCEDURE deparse_test_ddl_command_end(); + EXECUTE PROCEDURE deparse.deparse_test_ddl_command_end(); diff --git a/src/test/regress/sql/deparse_dump.sql b/src/test/regress/sql/deparse_dump.sql new file mode 100644 index 0000000000..877796a254 --- /dev/null +++ b/src/test/regress/sql/deparse_dump.sql @@ -0,0 +1 @@ +SELECT * FROM deparse.deparse_test_commands ORDER BY id; diff --git a/src/test/regress/sql/deparse_init.sql b/src/test/regress/sql/deparse_init.sql new file mode 100644 index 0000000000..b98aeb7933 --- /dev/null +++ b/src/test/regress/sql/deparse_init.sql @@ -0,0 +1,22 @@ +-- +-- DEPARSE_INIT +-- +CREATE SCHEMA deparse; +CREATE TABLE deparse.deparse_test_commands ( + id SERIAL PRIMARY KEY, + command TEXT +); +CREATE FUNCTION deparse.deparse_test_ddl_command_end() + RETURNS event_trigger + LANGUAGE plpgsql +AS $fn$ +BEGIN + INSERT INTO deparse.deparse_test_commands (command) + SELECT pg_event_trigger_expand_command(command) + FROM pg_event_trigger_get_creation_commands(); +END; +$fn$; + +CREATE EVENT TRIGGER deparse_test_trg_ddl_command_end + ON ddl_command_end + EXECUTE PROCEDURE deparse.deparse_test_ddl_command_end(); -- 2.39.5