diff options
Diffstat (limited to 'src/bin/pg_dump/t/002_pg_dump.pl')
-rw-r--r-- | src/bin/pg_dump/t/002_pg_dump.pl | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 668cb0f803f..afaa26badbe 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -3070,6 +3070,66 @@ my %tests = ( unlike => { no_privs => 1, }, }, + + 'CREATE ACCESS METHOD regress_test_table_am' => { + create_order => 11, + create_sql => 'CREATE ACCESS METHOD regress_table_am TYPE TABLE HANDLER heap_tableam_handler;', + regexp => qr/^ + \QCREATE ACCESS METHOD regress_table_am TYPE TABLE HANDLER heap_tableam_handler;\E + \n/xm, + like => { + %full_runs, + section_pre_data => 1, + }, + }, + + # It's a bit tricky to ensure that the proper SET of default table + # AM occurs. To achieve that we create a table with the standard + # AM, test AM, standard AM. That guarantees that there needs to be + # a SET interspersed. Then use a regex that prevents interspersed + # SET ...; statements, followed by the exptected CREATE TABLE. Not + # pretty, but seems hard to do better in this framework. + 'CREATE TABLE regress_pg_dump_table_am' => { + create_order => 12, + create_sql => ' + CREATE TABLE dump_test.regress_pg_dump_table_am_0() USING heap; + CREATE TABLE dump_test.regress_pg_dump_table_am_1 (col1 int) USING regress_table_am; + CREATE TABLE dump_test.regress_pg_dump_table_am_2() USING heap;', + regexp => qr/^ + \QSET default_table_access_method = regress_table_am;\E + (\n(?!SET[^;]+;)[^\n]*)* + \n\QCREATE TABLE dump_test.regress_pg_dump_table_am_1 (\E + \n\s+\Qcol1 integer\E + \n\);/xm, + like => { + %full_runs, + %dump_test_schema_runs, + section_pre_data => 1, + }, + unlike => { exclude_dump_test_schema => 1}, + }, + + 'CREATE MATERIALIZED VIEW regress_pg_dump_matview_am' => { + create_order => 13, + create_sql => ' + CREATE MATERIALIZED VIEW dump_test.regress_pg_dump_matview_am_0 USING heap AS SELECT 1; + CREATE MATERIALIZED VIEW dump_test.regress_pg_dump_matview_am_1 + USING regress_table_am AS SELECT count(*) FROM pg_class; + CREATE MATERIALIZED VIEW dump_test.regress_pg_dump_matview_am_2 USING heap AS SELECT 1;', + regexp => qr/^ + \QSET default_table_access_method = regress_table_am;\E + (\n(?!SET[^;]+;)[^\n]*)* + \QCREATE MATERIALIZED VIEW dump_test.regress_pg_dump_matview_am_1 AS\E + \n\s+\QSELECT count(*) AS count\E + \n\s+\QFROM pg_class\E + \n\s+\QWITH NO DATA;\E\n/xm, + like => { + %full_runs, + %dump_test_schema_runs, + section_pre_data => 1, + }, + unlike => { exclude_dump_test_schema => 1}, + } ); ######################################### |