Commit f339a998 authored by Michael Paquier's avatar Michael Paquier

Align better test output regex with grammar in pg_dump TAP tests

This enforces one-or-more character matches in the regular expressions
for pg_dump testing on SQL syntax output where zero-or-more matches
implies a syntax error.

Author: Daniel Gustafsson
Reviewed-by: David G. Johnston, Michael Paquier
Discussion: https://postgr.es/m/B313C32C-0E24-4AFB-95FF-6DA0C4E18A89@yesql.se
parent 537898bd
...@@ -448,20 +448,20 @@ my %tests = ( ...@@ -448,20 +448,20 @@ my %tests = (
}, },
'ALTER COLLATION test0 OWNER TO' => { 'ALTER COLLATION test0 OWNER TO' => {
regexp => qr/^\QALTER COLLATION public.test0 OWNER TO \E.*;/m, regexp => qr/^\QALTER COLLATION public.test0 OWNER TO \E.+;/m,
collation => 1, collation => 1,
like => { %full_runs, section_pre_data => 1, }, like => { %full_runs, section_pre_data => 1, },
unlike => { %dump_test_schema_runs, no_owner => 1, }, unlike => { %dump_test_schema_runs, no_owner => 1, },
}, },
'ALTER FOREIGN DATA WRAPPER dummy OWNER TO' => { 'ALTER FOREIGN DATA WRAPPER dummy OWNER TO' => {
regexp => qr/^ALTER FOREIGN DATA WRAPPER dummy OWNER TO .*;/m, regexp => qr/^ALTER FOREIGN DATA WRAPPER dummy OWNER TO .+;/m,
like => { %full_runs, section_pre_data => 1, }, like => { %full_runs, section_pre_data => 1, },
unlike => { no_owner => 1, }, unlike => { no_owner => 1, },
}, },
'ALTER SERVER s1 OWNER TO' => { 'ALTER SERVER s1 OWNER TO' => {
regexp => qr/^ALTER SERVER s1 OWNER TO .*;/m, regexp => qr/^ALTER SERVER s1 OWNER TO .+;/m,
like => { %full_runs, section_pre_data => 1, }, like => { %full_runs, section_pre_data => 1, },
unlike => { no_owner => 1, }, unlike => { no_owner => 1, },
}, },
...@@ -470,7 +470,7 @@ my %tests = ( ...@@ -470,7 +470,7 @@ my %tests = (
regexp => qr/^ regexp => qr/^
\QALTER FUNCTION dump_test.pltestlang_call_handler() \E \QALTER FUNCTION dump_test.pltestlang_call_handler() \E
\QOWNER TO \E \QOWNER TO \E
.*;/xm, .+;/xm,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
...@@ -483,7 +483,7 @@ my %tests = ( ...@@ -483,7 +483,7 @@ my %tests = (
regexp => qr/^ regexp => qr/^
\QALTER OPERATOR FAMILY dump_test.op_family USING btree \E \QALTER OPERATOR FAMILY dump_test.op_family USING btree \E
\QOWNER TO \E \QOWNER TO \E
.*;/xm, .+;/xm,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
...@@ -522,7 +522,7 @@ my %tests = ( ...@@ -522,7 +522,7 @@ my %tests = (
regexp => qr/^ regexp => qr/^
\QALTER OPERATOR CLASS dump_test.op_class USING btree \E \QALTER OPERATOR CLASS dump_test.op_class USING btree \E
\QOWNER TO \E \QOWNER TO \E
.*;/xm, .+;/xm,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
...@@ -532,13 +532,13 @@ my %tests = ( ...@@ -532,13 +532,13 @@ my %tests = (
}, },
'ALTER PUBLICATION pub1 OWNER TO' => { 'ALTER PUBLICATION pub1 OWNER TO' => {
regexp => qr/^ALTER PUBLICATION pub1 OWNER TO .*;/m, regexp => qr/^ALTER PUBLICATION pub1 OWNER TO .+;/m,
like => { %full_runs, section_post_data => 1, }, like => { %full_runs, section_post_data => 1, },
unlike => { no_owner => 1, }, unlike => { no_owner => 1, },
}, },
'ALTER LARGE OBJECT ... OWNER TO' => { 'ALTER LARGE OBJECT ... OWNER TO' => {
regexp => qr/^ALTER LARGE OBJECT \d+ OWNER TO .*;/m, regexp => qr/^ALTER LARGE OBJECT \d+ OWNER TO .+;/m,
like => { like => {
%full_runs, %full_runs,
column_inserts => 1, column_inserts => 1,
...@@ -554,13 +554,13 @@ my %tests = ( ...@@ -554,13 +554,13 @@ my %tests = (
}, },
'ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO' => { 'ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO' => {
regexp => qr/^ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO .*;/m, regexp => qr/^ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO .+;/m,
like => { %full_runs, section_pre_data => 1, }, like => { %full_runs, section_pre_data => 1, },
unlike => { no_owner => 1, }, unlike => { no_owner => 1, },
}, },
'ALTER SCHEMA dump_test OWNER TO' => { 'ALTER SCHEMA dump_test OWNER TO' => {
regexp => qr/^ALTER SCHEMA dump_test OWNER TO .*;/m, regexp => qr/^ALTER SCHEMA dump_test OWNER TO .+;/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
...@@ -570,7 +570,7 @@ my %tests = ( ...@@ -570,7 +570,7 @@ my %tests = (
}, },
'ALTER SCHEMA dump_test_second_schema OWNER TO' => { 'ALTER SCHEMA dump_test_second_schema OWNER TO' => {
regexp => qr/^ALTER SCHEMA dump_test_second_schema OWNER TO .*;/m, regexp => qr/^ALTER SCHEMA dump_test_second_schema OWNER TO .+;/m,
like => { like => {
%full_runs, %full_runs,
role => 1, role => 1,
...@@ -757,7 +757,7 @@ my %tests = ( ...@@ -757,7 +757,7 @@ my %tests = (
}, },
'ALTER TABLE test_table OWNER TO' => { 'ALTER TABLE test_table OWNER TO' => {
regexp => qr/^\QALTER TABLE dump_test.test_table OWNER TO \E.*;/m, regexp => qr/^\QALTER TABLE dump_test.test_table OWNER TO \E.+;/m,
like => { like => {
%full_runs, %full_runs,
%dump_test_schema_runs, %dump_test_schema_runs,
...@@ -790,7 +790,7 @@ my %tests = ( ...@@ -790,7 +790,7 @@ my %tests = (
}, },
'ALTER TABLE test_second_table OWNER TO' => { 'ALTER TABLE test_second_table OWNER TO' => {
regexp => qr/^\QALTER TABLE dump_test.test_second_table OWNER TO \E.*;/m, regexp => qr/^\QALTER TABLE dump_test.test_second_table OWNER TO \E.+;/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
...@@ -800,7 +800,7 @@ my %tests = ( ...@@ -800,7 +800,7 @@ my %tests = (
}, },
'ALTER TABLE measurement OWNER TO' => { 'ALTER TABLE measurement OWNER TO' => {
regexp => qr/^\QALTER TABLE dump_test.measurement OWNER TO \E.*;/m, regexp => qr/^\QALTER TABLE dump_test.measurement OWNER TO \E.+;/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
...@@ -811,7 +811,7 @@ my %tests = ( ...@@ -811,7 +811,7 @@ my %tests = (
'ALTER TABLE measurement_y2006m2 OWNER TO' => { 'ALTER TABLE measurement_y2006m2 OWNER TO' => {
regexp => regexp =>
qr/^\QALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO \E.*;/m, qr/^\QALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO \E.+;/m,
like => { like => {
%full_runs, %full_runs,
role => 1, role => 1,
...@@ -822,7 +822,7 @@ my %tests = ( ...@@ -822,7 +822,7 @@ my %tests = (
'ALTER FOREIGN TABLE foreign_table OWNER TO' => { 'ALTER FOREIGN TABLE foreign_table OWNER TO' => {
regexp => regexp =>
qr/^\QALTER FOREIGN TABLE dump_test.foreign_table OWNER TO \E.*;/m, qr/^\QALTER FOREIGN TABLE dump_test.foreign_table OWNER TO \E.+;/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
...@@ -833,7 +833,7 @@ my %tests = ( ...@@ -833,7 +833,7 @@ my %tests = (
'ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 OWNER TO' => { 'ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 OWNER TO' => {
regexp => regexp =>
qr/^\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO \E.*;/m, qr/^\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO \E.+;/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
...@@ -844,7 +844,7 @@ my %tests = ( ...@@ -844,7 +844,7 @@ my %tests = (
'ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 OWNER TO' => { 'ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 OWNER TO' => {
regexp => regexp =>
qr/^\QALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO \E.*;/m, qr/^\QALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO \E.+;/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
...@@ -895,14 +895,14 @@ my %tests = ( ...@@ -895,14 +895,14 @@ my %tests = (
}, },
'COMMENT ON DATABASE postgres' => { 'COMMENT ON DATABASE postgres' => {
regexp => qr/^COMMENT ON DATABASE postgres IS .*;/m, regexp => qr/^COMMENT ON DATABASE postgres IS .+;/m,
# Should appear in the same tests as "CREATE DATABASE postgres" # Should appear in the same tests as "CREATE DATABASE postgres"
like => { createdb => 1, }, like => { createdb => 1, },
}, },
'COMMENT ON EXTENSION plpgsql' => { 'COMMENT ON EXTENSION plpgsql' => {
regexp => qr/^COMMENT ON EXTENSION plpgsql IS .*;/m, regexp => qr/^COMMENT ON EXTENSION plpgsql IS .+;/m,
# this shouldn't ever get emitted anymore # this shouldn't ever get emitted anymore
like => {}, like => {},
...@@ -1353,7 +1353,7 @@ my %tests = ( ...@@ -1353,7 +1353,7 @@ my %tests = (
'CREATE DATABASE postgres' => { 'CREATE DATABASE postgres' => {
regexp => qr/^ regexp => qr/^
\QCREATE DATABASE postgres WITH TEMPLATE = template0 \E \QCREATE DATABASE postgres WITH TEMPLATE = template0 \E
.*;/xm, .+;/xm,
like => { createdb => 1, }, like => { createdb => 1, },
}, },
...@@ -1362,7 +1362,7 @@ my %tests = ( ...@@ -1362,7 +1362,7 @@ my %tests = (
create_sql => 'CREATE DATABASE dump_test;', create_sql => 'CREATE DATABASE dump_test;',
regexp => qr/^ regexp => qr/^
\QCREATE DATABASE dump_test WITH TEMPLATE = template0 \E \QCREATE DATABASE dump_test WITH TEMPLATE = template0 \E
.*;/xm, .+;/xm,
like => { pg_dumpall_dbprivs => 1, }, like => { pg_dumpall_dbprivs => 1, },
}, },
...@@ -2651,7 +2651,7 @@ my %tests = ( ...@@ -2651,7 +2651,7 @@ my %tests = (
'DROP ROLE pg_' => { 'DROP ROLE pg_' => {
regexp => qr/^ regexp => qr/^
\QDROP ROLE pg_\E.*; \QDROP ROLE pg_\E.+;
/xm, /xm,
# this shouldn't ever get emitted anywhere # this shouldn't ever get emitted anywhere
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment