1use strict; 2use warnings; 3 4use Config; 5use PostgresNode; 6use TestLib; 7use Test::More; 8 9my $tempdir = TestLib::tempdir; 10my $tempdir_short = TestLib::tempdir_short; 11 12############################################################### 13# Definition of the pg_dump runs to make. 14# 15# Each of these runs are named and those names are used below 16# to define how each test should (or shouldn't) treat a result 17# from a given run. 18# 19# test_key indicates that a given run should simply use the same 20# set of like/unlike tests as another run, and which run that is. 21# 22# dump_cmd is the pg_dump command to run, which is an array of 23# the full command and arguments to run. Note that this is run 24# using $node->command_ok(), so the port does not need to be 25# specified and is pulled from $PGPORT, which is set by the 26# PostgresNode system. 27# 28# restore_cmd is the pg_restore command to run, if any. Note 29# that this should generally be used when the pg_dump goes to 30# a non-text file and that the restore can then be used to 31# generate a text file to run through the tests from the 32# non-text file generated by pg_dump. 33# 34# TODO: Have pg_restore actually restore to an independent 35# database and then pg_dump *that* database (or something along 36# those lines) to validate that part of the process. 37 38my %pgdump_runs = ( 39 binary_upgrade => { 40 dump_cmd => [ 41 'pg_dump', 42 '--no-sync', 43 '--format=custom', 44 "--file=$tempdir/binary_upgrade.dump", 45 '-w', 46 '--schema-only', 47 '--binary-upgrade', 48 '-d', 'postgres', # alternative way to specify database 49 ], 50 restore_cmd => [ 51 'pg_restore', '-Fc', '--verbose', 52 "--file=$tempdir/binary_upgrade.sql", 53 "$tempdir/binary_upgrade.dump", 54 ], 55 }, 56 clean => { 57 dump_cmd => [ 58 'pg_dump', 59 '--no-sync', 60 "--file=$tempdir/clean.sql", 61 '-c', 62 '-d', 'postgres', # alternative way to specify database 63 ], 64 }, 65 clean_if_exists => { 66 dump_cmd => [ 67 'pg_dump', 68 '--no-sync', 69 "--file=$tempdir/clean_if_exists.sql", 70 '-c', 71 '--if-exists', 72 '--encoding=UTF8', # no-op, just tests that option is accepted 73 'postgres', 74 ], 75 }, 76 column_inserts => { 77 dump_cmd => [ 78 'pg_dump', '--no-sync', 79 "--file=$tempdir/column_inserts.sql", '-a', 80 '--column-inserts', 'postgres', 81 ], 82 }, 83 createdb => { 84 dump_cmd => [ 85 'pg_dump', 86 '--no-sync', 87 "--file=$tempdir/createdb.sql", 88 '-C', 89 '-R', # no-op, just for testing 90 '-v', 91 'postgres', 92 ], 93 }, 94 data_only => { 95 dump_cmd => [ 96 'pg_dump', 97 '--no-sync', 98 "--file=$tempdir/data_only.sql", 99 '-a', 100 '--superuser=test_superuser', 101 '--disable-triggers', 102 '-v', # no-op, just make sure it works 103 'postgres', 104 ], 105 }, 106 defaults => { 107 dump_cmd => [ 108 'pg_dump', '--no-sync', 109 '-f', "$tempdir/defaults.sql", 110 'postgres', 111 ], 112 }, 113 defaults_no_public => { 114 database => 'regress_pg_dump_test', 115 dump_cmd => [ 116 'pg_dump', '--no-sync', '-f', "$tempdir/defaults_no_public.sql", 117 'regress_pg_dump_test', 118 ], 119 }, 120 defaults_no_public_clean => { 121 database => 'regress_pg_dump_test', 122 dump_cmd => [ 123 'pg_dump', '--no-sync', '-c', '-f', 124 "$tempdir/defaults_no_public_clean.sql", 125 'regress_pg_dump_test', 126 ], 127 }, 128 129 # Do not use --no-sync to give test coverage for data sync. 130 defaults_custom_format => { 131 test_key => 'defaults', 132 dump_cmd => [ 133 'pg_dump', '-Fc', '-Z6', 134 "--file=$tempdir/defaults_custom_format.dump", 'postgres', 135 ], 136 restore_cmd => [ 137 'pg_restore', '-Fc', 138 "--file=$tempdir/defaults_custom_format.sql", 139 "$tempdir/defaults_custom_format.dump", 140 ], 141 }, 142 143 # Do not use --no-sync to give test coverage for data sync. 144 defaults_dir_format => { 145 test_key => 'defaults', 146 dump_cmd => [ 147 'pg_dump', '-Fd', 148 "--file=$tempdir/defaults_dir_format", 'postgres', 149 ], 150 restore_cmd => [ 151 'pg_restore', '-Fd', 152 "--file=$tempdir/defaults_dir_format.sql", 153 "$tempdir/defaults_dir_format", 154 ], 155 }, 156 157 # Do not use --no-sync to give test coverage for data sync. 158 defaults_parallel => { 159 test_key => 'defaults', 160 dump_cmd => [ 161 'pg_dump', '-Fd', '-j2', "--file=$tempdir/defaults_parallel", 162 'postgres', 163 ], 164 restore_cmd => [ 165 'pg_restore', 166 "--file=$tempdir/defaults_parallel.sql", 167 "$tempdir/defaults_parallel", 168 ], 169 }, 170 171 # Do not use --no-sync to give test coverage for data sync. 172 defaults_tar_format => { 173 test_key => 'defaults', 174 dump_cmd => [ 175 'pg_dump', '-Ft', 176 "--file=$tempdir/defaults_tar_format.tar", 'postgres', 177 ], 178 restore_cmd => [ 179 'pg_restore', 180 '--format=tar', 181 "--file=$tempdir/defaults_tar_format.sql", 182 "$tempdir/defaults_tar_format.tar", 183 ], 184 }, 185 exclude_dump_test_schema => { 186 dump_cmd => [ 187 'pg_dump', '--no-sync', 188 "--file=$tempdir/exclude_dump_test_schema.sql", 189 '--exclude-schema=dump_test', 'postgres', 190 ], 191 }, 192 exclude_test_table => { 193 dump_cmd => [ 194 'pg_dump', '--no-sync', 195 "--file=$tempdir/exclude_test_table.sql", 196 '--exclude-table=dump_test.test_table', 'postgres', 197 ], 198 }, 199 exclude_test_table_data => { 200 dump_cmd => [ 201 'pg_dump', 202 '--no-sync', 203 "--file=$tempdir/exclude_test_table_data.sql", 204 '--exclude-table-data=dump_test.test_table', 205 '--no-unlogged-table-data', 206 'postgres', 207 ], 208 }, 209 pg_dumpall_globals => { 210 dump_cmd => [ 211 'pg_dumpall', '-v', "--file=$tempdir/pg_dumpall_globals.sql", 212 '-g', '--no-sync', 213 ], 214 }, 215 pg_dumpall_globals_clean => { 216 dump_cmd => [ 217 'pg_dumpall', "--file=$tempdir/pg_dumpall_globals_clean.sql", 218 '-g', '-c', '--no-sync', 219 ], 220 }, 221 pg_dumpall_dbprivs => { 222 dump_cmd => [ 223 'pg_dumpall', '--no-sync', 224 "--file=$tempdir/pg_dumpall_dbprivs.sql", 225 ], 226 }, 227 no_blobs => { 228 dump_cmd => [ 229 'pg_dump', '--no-sync', 230 "--file=$tempdir/no_blobs.sql", '-B', 231 'postgres', 232 ], 233 }, 234 no_privs => { 235 dump_cmd => [ 236 'pg_dump', '--no-sync', 237 "--file=$tempdir/no_privs.sql", '-x', 238 'postgres', 239 ], 240 }, 241 no_owner => { 242 dump_cmd => [ 243 'pg_dump', '--no-sync', 244 "--file=$tempdir/no_owner.sql", '-O', 245 'postgres', 246 ], 247 }, 248 only_dump_test_schema => { 249 dump_cmd => [ 250 'pg_dump', '--no-sync', 251 "--file=$tempdir/only_dump_test_schema.sql", 252 '--schema=dump_test', 'postgres', 253 ], 254 }, 255 only_dump_test_table => { 256 dump_cmd => [ 257 'pg_dump', 258 '--no-sync', 259 "--file=$tempdir/only_dump_test_table.sql", 260 '--table=dump_test.test_table', 261 '--lock-wait-timeout=1000000', 262 'postgres', 263 ], 264 }, 265 role => { 266 dump_cmd => [ 267 'pg_dump', 268 '--no-sync', 269 "--file=$tempdir/role.sql", 270 '--role=regress_dump_test_role', 271 '--schema=dump_test_second_schema', 272 'postgres', 273 ], 274 }, 275 role_parallel => { 276 test_key => 'role', 277 dump_cmd => [ 278 'pg_dump', 279 '--no-sync', 280 '--format=directory', 281 '--jobs=2', 282 "--file=$tempdir/role_parallel", 283 '--role=regress_dump_test_role', 284 '--schema=dump_test_second_schema', 285 'postgres', 286 ], 287 restore_cmd => [ 288 'pg_restore', "--file=$tempdir/role_parallel.sql", 289 "$tempdir/role_parallel", 290 ], 291 }, 292 schema_only => { 293 dump_cmd => [ 294 'pg_dump', '--format=plain', 295 "--file=$tempdir/schema_only.sql", '--no-sync', 296 '-s', 'postgres', 297 ], 298 }, 299 section_pre_data => { 300 dump_cmd => [ 301 'pg_dump', "--file=$tempdir/section_pre_data.sql", 302 '--section=pre-data', '--no-sync', 303 'postgres', 304 ], 305 }, 306 section_data => { 307 dump_cmd => [ 308 'pg_dump', "--file=$tempdir/section_data.sql", 309 '--section=data', '--no-sync', 310 'postgres', 311 ], 312 }, 313 section_post_data => { 314 dump_cmd => [ 315 'pg_dump', "--file=$tempdir/section_post_data.sql", 316 '--section=post-data', '--no-sync', 'postgres', 317 ], 318 }, 319 test_schema_plus_blobs => { 320 dump_cmd => [ 321 'pg_dump', "--file=$tempdir/test_schema_plus_blobs.sql", 322 323 '--schema=dump_test', '-b', '-B', '--no-sync', 'postgres', 324 ], 325 }, 326 with_oids => { 327 dump_cmd => [ 328 'pg_dump', '--oids', 329 '--no-sync', "--file=$tempdir/with_oids.sql", 330 'postgres', 331 ], 332 },); 333 334############################################################### 335# Definition of the tests to run. 336# 337# Each test is defined using the log message that will be used. 338# 339# A regexp should be defined for each test which provides the 340# basis for the test. That regexp will be run against the output 341# file of each of the runs which the test is to be run against 342# and the success of the result will depend on if the regexp 343# result matches the expected 'like' or 'unlike' case. 344# 345# The runs listed as 'like' will be checked if they match the 346# regexp and, if so, the test passes. All runs which are not 347# listed as 'like' will be checked to ensure they don't match 348# the regexp; if they do, the test will fail. 349# 350# The below hashes provide convenience sets of runs. Individual 351# runs can be excluded from a general hash by placing that run 352# into the 'unlike' section. 353# 354# For example, there is an 'exclude_test_table' run which runs a 355# full pg_dump but with an exclude flag to not include the test 356# table. The CREATE TABLE test which creates the test table is 357# defined with %full_runs but then has 'exclude_test_table' in 358# its 'unlike' list, excluding that test. 359# 360# There can then be a 'create_sql' and 'create_order' for a 361# given test. The 'create_sql' commands are collected up in 362# 'create_order' and then run against the database prior to any 363# of the pg_dump runs happening. This is what "seeds" the 364# system with objects to be dumped out. 365# 366# Building of this hash takes a bit of time as all of the regexps 367# included in it are compiled. This greatly improves performance 368# as the regexps are used for each run the test applies to. 369 370# Tests which target the 'dump_test' schema, specifically. 371my %dump_test_schema_runs = ( 372 only_dump_test_schema => 1, 373 test_schema_plus_blobs => 1,); 374 375# Tests which are considered 'full' dumps by pg_dump, but there 376# are flags used to exclude specific items (ACLs, blobs, etc). 377my %full_runs = ( 378 binary_upgrade => 1, 379 clean => 1, 380 clean_if_exists => 1, 381 createdb => 1, 382 defaults => 1, 383 exclude_dump_test_schema => 1, 384 exclude_test_table => 1, 385 exclude_test_table_data => 1, 386 no_blobs => 1, 387 no_owner => 1, 388 no_privs => 1, 389 pg_dumpall_dbprivs => 1, 390 schema_only => 1, 391 with_oids => 1,); 392 393# This is where the actual tests are defined. 394my %tests = ( 395 'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role GRANT' => { 396 create_order => 14, 397 create_sql => 'ALTER DEFAULT PRIVILEGES 398 FOR ROLE regress_dump_test_role IN SCHEMA dump_test 399 GRANT SELECT ON TABLES TO regress_dump_test_role;', 400 regexp => qr/^ 401 \QALTER DEFAULT PRIVILEGES \E 402 \QFOR ROLE regress_dump_test_role IN SCHEMA dump_test \E 403 \QGRANT SELECT ON TABLES TO regress_dump_test_role;\E 404 /xm, 405 like => 406 { %full_runs, %dump_test_schema_runs, section_post_data => 1, }, 407 unlike => { 408 exclude_dump_test_schema => 1, 409 no_privs => 1, 410 }, 411 }, 412 413 'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role GRANT EXECUTE ON FUNCTIONS' 414 => { 415 create_order => 15, 416 create_sql => 'ALTER DEFAULT PRIVILEGES 417 FOR ROLE regress_dump_test_role IN SCHEMA dump_test 418 GRANT EXECUTE ON FUNCTIONS TO regress_dump_test_role;', 419 regexp => qr/^ 420 \QALTER DEFAULT PRIVILEGES \E 421 \QFOR ROLE regress_dump_test_role IN SCHEMA dump_test \E 422 \QGRANT ALL ON FUNCTIONS TO regress_dump_test_role;\E 423 /xm, 424 like => 425 { %full_runs, %dump_test_schema_runs, section_post_data => 1, }, 426 unlike => { 427 exclude_dump_test_schema => 1, 428 no_privs => 1, 429 }, 430 }, 431 432 'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role REVOKE' => { 433 create_order => 55, 434 create_sql => 'ALTER DEFAULT PRIVILEGES 435 FOR ROLE regress_dump_test_role 436 REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;', 437 regexp => qr/^ 438 \QALTER DEFAULT PRIVILEGES \E 439 \QFOR ROLE regress_dump_test_role \E 440 \QREVOKE ALL ON FUNCTIONS FROM PUBLIC;\E 441 /xm, 442 like => { %full_runs, section_post_data => 1, }, 443 unlike => { no_privs => 1, }, 444 }, 445 446 'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role REVOKE SELECT' 447 => { 448 create_order => 56, 449 create_sql => 'ALTER DEFAULT PRIVILEGES 450 FOR ROLE regress_dump_test_role 451 REVOKE SELECT ON TABLES FROM regress_dump_test_role;', 452 regexp => qr/^ 453 \QALTER DEFAULT PRIVILEGES \E 454 \QFOR ROLE regress_dump_test_role \E 455 \QREVOKE ALL ON TABLES FROM regress_dump_test_role;\E\n 456 \QALTER DEFAULT PRIVILEGES \E 457 \QFOR ROLE regress_dump_test_role \E 458 \QGRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,UPDATE ON TABLES TO regress_dump_test_role;\E 459 /xm, 460 like => { %full_runs, section_post_data => 1, }, 461 unlike => { no_privs => 1, }, 462 }, 463 464 'ALTER ROLE regress_dump_test_role' => { 465 regexp => qr/^ 466 \QALTER ROLE regress_dump_test_role WITH \E 467 \QNOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB NOLOGIN \E 468 \QNOREPLICATION NOBYPASSRLS;\E 469 /xm, 470 like => { 471 pg_dumpall_dbprivs => 1, 472 pg_dumpall_globals => 1, 473 pg_dumpall_globals_clean => 1, 474 }, 475 }, 476 477 'ALTER COLLATION test0 OWNER TO' => { 478 regexp => qr/^ALTER COLLATION public.test0 OWNER TO .*;/m, 479 collation => 1, 480 like => { %full_runs, section_pre_data => 1, }, 481 unlike => { %dump_test_schema_runs, no_owner => 1, }, 482 }, 483 484 'ALTER FOREIGN DATA WRAPPER dummy OWNER TO' => { 485 regexp => qr/^ALTER FOREIGN DATA WRAPPER dummy OWNER TO .*;/m, 486 like => { %full_runs, section_pre_data => 1, }, 487 unlike => { no_owner => 1, }, 488 }, 489 490 'ALTER SERVER s1 OWNER TO' => { 491 regexp => qr/^ALTER SERVER s1 OWNER TO .*;/m, 492 like => { %full_runs, section_pre_data => 1, }, 493 unlike => { no_owner => 1, }, 494 }, 495 496 'ALTER FUNCTION dump_test.pltestlang_call_handler() OWNER TO' => { 497 regexp => qr/^ 498 \QALTER FUNCTION dump_test.pltestlang_call_handler() \E 499 \QOWNER TO \E 500 .*;/xm, 501 like => 502 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 503 unlike => { 504 exclude_dump_test_schema => 1, 505 no_owner => 1, 506 }, 507 }, 508 509 'ALTER OPERATOR FAMILY dump_test.op_family OWNER TO' => { 510 regexp => qr/^ 511 \QALTER OPERATOR FAMILY dump_test.op_family USING btree \E 512 \QOWNER TO \E 513 .*;/xm, 514 like => 515 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 516 unlike => { 517 exclude_dump_test_schema => 1, 518 no_owner => 1, 519 }, 520 }, 521 522 'ALTER OPERATOR FAMILY dump_test.op_family USING btree' => { 523 create_order => 75, 524 create_sql => 525 'ALTER OPERATOR FAMILY dump_test.op_family USING btree ADD 526 OPERATOR 1 <(bigint,int4), 527 OPERATOR 2 <=(bigint,int4), 528 OPERATOR 3 =(bigint,int4), 529 OPERATOR 4 >=(bigint,int4), 530 OPERATOR 5 >(bigint,int4), 531 FUNCTION 1 (int4, int4) btint4cmp(int4,int4), 532 FUNCTION 2 (int4, int4) btint4sortsupport(internal);', 533 regexp => qr/^ 534 \QALTER OPERATOR FAMILY dump_test.op_family USING btree ADD\E\n\s+ 535 \QOPERATOR 1 <(bigint,integer) ,\E\n\s+ 536 \QOPERATOR 2 <=(bigint,integer) ,\E\n\s+ 537 \QOPERATOR 3 =(bigint,integer) ,\E\n\s+ 538 \QOPERATOR 4 >=(bigint,integer) ,\E\n\s+ 539 \QOPERATOR 5 >(bigint,integer) ,\E\n\s+ 540 \QFUNCTION 1 (integer, integer) btint4cmp(integer,integer) ,\E\n\s+ 541 \QFUNCTION 2 (integer, integer) btint4sortsupport(internal);\E 542 /xm, 543 like => 544 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 545 unlike => { exclude_dump_test_schema => 1, }, 546 }, 547 548 'ALTER OPERATOR CLASS dump_test.op_class OWNER TO' => { 549 regexp => qr/^ 550 \QALTER OPERATOR CLASS dump_test.op_class USING btree \E 551 \QOWNER TO \E 552 .*;/xm, 553 like => 554 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 555 unlike => { 556 exclude_dump_test_schema => 1, 557 no_owner => 1, 558 }, 559 }, 560 561 'ALTER PUBLICATION pub1 OWNER TO' => { 562 regexp => qr/^ALTER PUBLICATION pub1 OWNER TO .*;/m, 563 like => { %full_runs, section_post_data => 1, }, 564 unlike => { no_owner => 1, }, 565 }, 566 567 'ALTER LARGE OBJECT ... OWNER TO' => { 568 regexp => qr/^ALTER LARGE OBJECT \d+ OWNER TO .*;/m, 569 like => { 570 %full_runs, 571 column_inserts => 1, 572 data_only => 1, 573 section_pre_data => 1, 574 test_schema_plus_blobs => 1, 575 }, 576 unlike => { 577 no_blobs => 1, 578 no_owner => 1, 579 schema_only => 1, 580 }, 581 }, 582 583 'ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO' => { 584 regexp => qr/^ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO .*;/m, 585 like => { %full_runs, section_pre_data => 1, }, 586 unlike => { no_owner => 1, }, 587 }, 588 589 'ALTER SCHEMA dump_test OWNER TO' => { 590 regexp => qr/^ALTER SCHEMA dump_test OWNER TO .*;/m, 591 like => 592 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 593 unlike => { 594 exclude_dump_test_schema => 1, 595 no_owner => 1, 596 }, 597 }, 598 599 'ALTER SCHEMA dump_test_second_schema OWNER TO' => { 600 regexp => qr/^ALTER SCHEMA dump_test_second_schema OWNER TO .*;/m, 601 like => { 602 %full_runs, 603 role => 1, 604 section_pre_data => 1, 605 }, 606 unlike => { no_owner => 1, }, 607 }, 608 609 'ALTER SEQUENCE test_table_col1_seq' => { 610 regexp => qr/^ 611 \QALTER SEQUENCE dump_test.test_table_col1_seq OWNED BY dump_test.test_table.col1;\E 612 /xm, 613 like => { 614 %full_runs, 615 %dump_test_schema_runs, 616 only_dump_test_table => 1, 617 section_pre_data => 1, 618 }, 619 unlike => { 620 exclude_dump_test_schema => 1, 621 exclude_test_table => 1, 622 }, 623 }, 624 625 'ALTER SEQUENCE test_third_table_col1_seq' => { 626 regexp => qr/^ 627 \QALTER SEQUENCE dump_test_second_schema.test_third_table_col1_seq OWNED BY dump_test_second_schema.test_third_table.col1;\E 628 /xm, 629 like => { 630 %full_runs, 631 role => 1, 632 section_pre_data => 1, 633 }, 634 }, 635 636 'ALTER TABLE ONLY test_table ADD CONSTRAINT ... PRIMARY KEY' => { 637 regexp => qr/^ 638 \QALTER TABLE ONLY dump_test.test_table\E \n^\s+ 639 \QADD CONSTRAINT test_table_pkey PRIMARY KEY (col1);\E 640 /xm, 641 like => { 642 %full_runs, 643 %dump_test_schema_runs, 644 only_dump_test_table => 1, 645 section_post_data => 1, 646 }, 647 unlike => { 648 exclude_dump_test_schema => 1, 649 exclude_test_table => 1, 650 }, 651 }, 652 653 'ALTER TABLE (partitioned) ADD CONSTRAINT ... FOREIGN KEY' => { 654 create_order => 4, 655 create_sql => 'CREATE TABLE dump_test.test_table_fk ( 656 col1 int references dump_test.test_table) 657 PARTITION BY RANGE (col1); 658 CREATE TABLE dump_test.test_table_fk_1 659 PARTITION OF dump_test.test_table_fk 660 FOR VALUES FROM (0) TO (10);', 661 regexp => qr/ 662 \QADD CONSTRAINT test_table_fk_col1_fkey FOREIGN KEY (col1) REFERENCES dump_test.test_table\E 663 /xm, 664 like => { 665 %full_runs, %dump_test_schema_runs, section_post_data => 1, 666 }, 667 unlike => { 668 exclude_dump_test_schema => 1, 669 }, 670 }, 671 672 'ALTER TABLE ONLY test_table ALTER COLUMN col1 SET STATISTICS 90' => { 673 create_order => 93, 674 create_sql => 675 'ALTER TABLE dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;', 676 regexp => qr/^ 677 \QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;\E\n 678 /xm, 679 like => { 680 %full_runs, 681 %dump_test_schema_runs, 682 only_dump_test_table => 1, 683 section_pre_data => 1, 684 }, 685 unlike => { 686 exclude_dump_test_schema => 1, 687 exclude_test_table => 1, 688 }, 689 }, 690 691 'ALTER TABLE ONLY test_table ALTER COLUMN col2 SET STORAGE' => { 692 create_order => 94, 693 create_sql => 694 'ALTER TABLE dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;', 695 regexp => qr/^ 696 \QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;\E\n 697 /xm, 698 like => { 699 %full_runs, 700 %dump_test_schema_runs, 701 only_dump_test_table => 1, 702 section_pre_data => 1, 703 }, 704 unlike => { 705 exclude_dump_test_schema => 1, 706 exclude_test_table => 1, 707 }, 708 }, 709 710 'ALTER TABLE ONLY test_table ALTER COLUMN col3 SET STORAGE' => { 711 create_order => 95, 712 create_sql => 713 'ALTER TABLE dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;', 714 regexp => qr/^ 715 \QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;\E\n 716 /xm, 717 like => { 718 %full_runs, 719 %dump_test_schema_runs, 720 only_dump_test_table => 1, 721 section_pre_data => 1, 722 }, 723 unlike => { 724 exclude_dump_test_schema => 1, 725 exclude_test_table => 1, 726 }, 727 }, 728 729 'ALTER TABLE ONLY test_table ALTER COLUMN col4 SET n_distinct' => { 730 create_order => 95, 731 create_sql => 732 'ALTER TABLE dump_test.test_table ALTER COLUMN col4 SET (n_distinct = 10);', 733 regexp => qr/^ 734 \QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col4 SET (n_distinct=10);\E\n 735 /xm, 736 like => { 737 %full_runs, 738 %dump_test_schema_runs, 739 only_dump_test_table => 1, 740 section_pre_data => 1, 741 }, 742 unlike => { 743 exclude_dump_test_schema => 1, 744 exclude_test_table => 1, 745 }, 746 }, 747 748 'ALTER TABLE ONLY dump_test.measurement ATTACH PARTITION measurement_y2006m2' 749 => { 750 regexp => qr/^ 751 \QALTER TABLE ONLY dump_test.measurement ATTACH PARTITION dump_test_second_schema.measurement_y2006m2 \E 752 \QFOR VALUES FROM ('2006-02-01') TO ('2006-03-01');\E\n 753 /xm, 754 like => { 755 %full_runs, 756 role => 1, 757 section_pre_data => 1, 758 binary_upgrade => 1, 759 }, 760 }, 761 762 'ALTER TABLE test_table CLUSTER ON test_table_pkey' => { 763 create_order => 96, 764 create_sql => 765 'ALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey', 766 regexp => qr/^ 767 \QALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey;\E\n 768 /xm, 769 like => { 770 %full_runs, 771 %dump_test_schema_runs, 772 only_dump_test_table => 1, 773 section_post_data => 1, 774 }, 775 unlike => { 776 exclude_dump_test_schema => 1, 777 exclude_test_table => 1, 778 }, 779 }, 780 781 'ALTER TABLE test_table DISABLE TRIGGER ALL' => { 782 regexp => qr/^ 783 \QSET SESSION AUTHORIZATION 'test_superuser';\E\n\n 784 \QALTER TABLE dump_test.test_table DISABLE TRIGGER ALL;\E\n\n 785 \QCOPY dump_test.test_table (col1, col2, col3, col4) FROM stdin;\E 786 \n(?:\d\t\\N\t\\N\t\\N\n){9}\\\.\n\n\n 787 \QALTER TABLE dump_test.test_table ENABLE TRIGGER ALL;\E/xm, 788 like => { data_only => 1, }, 789 }, 790 791 'ALTER FOREIGN TABLE foreign_table ALTER COLUMN c1 OPTIONS' => { 792 regexp => qr/^ 793 \QALTER FOREIGN TABLE dump_test.foreign_table ALTER COLUMN c1 OPTIONS (\E\n 794 \s+\Qcolumn_name 'col1'\E\n 795 \Q);\E\n 796 /xm, 797 like => 798 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 799 unlike => { exclude_dump_test_schema => 1, }, 800 }, 801 802 'ALTER TABLE test_table OWNER TO' => { 803 regexp => qr/^ALTER TABLE dump_test.test_table OWNER TO .*;/m, 804 like => { 805 %full_runs, 806 %dump_test_schema_runs, 807 only_dump_test_table => 1, 808 section_pre_data => 1, 809 }, 810 unlike => { 811 exclude_dump_test_schema => 1, 812 exclude_test_table => 1, 813 no_owner => 1, 814 }, 815 }, 816 817 'ALTER TABLE test_table ENABLE ROW LEVEL SECURITY' => { 818 create_order => 23, 819 create_sql => 'ALTER TABLE dump_test.test_table 820 ENABLE ROW LEVEL SECURITY;', 821 regexp => 822 qr/^ALTER TABLE dump_test.test_table ENABLE ROW LEVEL SECURITY;/m, 823 like => { 824 %full_runs, 825 %dump_test_schema_runs, 826 only_dump_test_table => 1, 827 section_post_data => 1, 828 }, 829 unlike => { 830 exclude_dump_test_schema => 1, 831 exclude_test_table => 1, 832 }, 833 }, 834 835 'ALTER TABLE test_second_table OWNER TO' => { 836 regexp => qr/^ALTER TABLE dump_test.test_second_table OWNER TO .*;/m, 837 like => 838 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 839 unlike => { 840 exclude_dump_test_schema => 1, 841 no_owner => 1, 842 }, 843 }, 844 845 'ALTER TABLE test_third_table OWNER TO' => { 846 regexp => 847 qr/^ALTER TABLE dump_test_second_schema.test_third_table OWNER TO .*;/m, 848 like => { 849 %full_runs, 850 role => 1, 851 section_pre_data => 1, 852 }, 853 unlike => { no_owner => 1, }, 854 }, 855 856 'ALTER TABLE measurement OWNER TO' => { 857 regexp => qr/^ALTER TABLE dump_test.measurement OWNER TO .*;/m, 858 like => 859 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 860 unlike => { 861 exclude_dump_test_schema => 1, 862 no_owner => 1, 863 }, 864 }, 865 866 'ALTER TABLE measurement_y2006m2 OWNER TO' => { 867 regexp => 868 qr/^ALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO .*;/m, 869 like => { 870 %full_runs, 871 role => 1, 872 section_pre_data => 1, 873 }, 874 unlike => { no_owner => 1, }, 875 }, 876 877 'ALTER FOREIGN TABLE foreign_table OWNER TO' => { 878 regexp => 879 qr/^ALTER FOREIGN TABLE dump_test.foreign_table OWNER TO .*;/m, 880 like => 881 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 882 unlike => { 883 exclude_dump_test_schema => 1, 884 no_owner => 1, 885 }, 886 }, 887 888 'ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 OWNER TO' => { 889 regexp => 890 qr/^ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO .*;/m, 891 like => 892 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 893 unlike => { 894 exclude_dump_test_schema => 1, 895 no_owner => 1, 896 }, 897 }, 898 899 'ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 OWNER TO' => { 900 regexp => 901 qr/^ALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO .*;/m, 902 like => 903 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 904 unlike => { 905 exclude_dump_test_schema => 1, 906 only_dump_test_table => 1, 907 no_owner => 1, 908 role => 1, 909 }, 910 }, 911 912 'BLOB create (using lo_from_bytea)' => { 913 create_order => 50, 914 create_sql => 915 'SELECT pg_catalog.lo_from_bytea(0, \'\\x310a320a330a340a350a360a370a380a390a\');', 916 regexp => qr/^SELECT pg_catalog\.lo_create\('\d+'\);/m, 917 like => { 918 %full_runs, 919 column_inserts => 1, 920 data_only => 1, 921 section_pre_data => 1, 922 test_schema_plus_blobs => 1, 923 }, 924 unlike => { 925 schema_only => 1, 926 no_blobs => 1, 927 }, 928 }, 929 930 'BLOB load (using lo_from_bytea)' => { 931 regexp => qr/^ 932 \QSELECT pg_catalog.lo_open\E \('\d+',\ \d+\);\n 933 \QSELECT pg_catalog.lowrite(0, \E 934 \Q'\x310a320a330a340a350a360a370a380a390a');\E\n 935 \QSELECT pg_catalog.lo_close(0);\E 936 /xm, 937 like => { 938 %full_runs, 939 column_inserts => 1, 940 data_only => 1, 941 section_data => 1, 942 test_schema_plus_blobs => 1, 943 }, 944 unlike => { 945 binary_upgrade => 1, 946 no_blobs => 1, 947 schema_only => 1, 948 }, 949 }, 950 951 'COMMENT ON DATABASE postgres' => { 952 regexp => qr/^COMMENT ON DATABASE postgres IS .*;/m, 953 954 # Should appear in the same tests as "CREATE DATABASE postgres" 955 like => { createdb => 1, }, 956 }, 957 958 'COMMENT ON EXTENSION plpgsql' => { 959 regexp => qr/^COMMENT ON EXTENSION plpgsql IS .*;/m, 960 961 # this shouldn't ever get emitted anymore 962 like => {}, 963 }, 964 965 'COMMENT ON TABLE dump_test.test_table' => { 966 create_order => 36, 967 create_sql => 'COMMENT ON TABLE dump_test.test_table 968 IS \'comment on table\';', 969 regexp => 970 qr/^COMMENT ON TABLE dump_test.test_table IS 'comment on table';/m, 971 like => { 972 %full_runs, 973 %dump_test_schema_runs, 974 only_dump_test_table => 1, 975 section_pre_data => 1, 976 }, 977 unlike => { 978 exclude_dump_test_schema => 1, 979 exclude_test_table => 1, 980 }, 981 }, 982 983 'COMMENT ON COLUMN dump_test.test_table.col1' => { 984 create_order => 36, 985 create_sql => 'COMMENT ON COLUMN dump_test.test_table.col1 986 IS \'comment on column\';', 987 regexp => qr/^ 988 \QCOMMENT ON COLUMN dump_test.test_table.col1 IS 'comment on column';\E 989 /xm, 990 like => { 991 %full_runs, 992 %dump_test_schema_runs, 993 only_dump_test_table => 1, 994 section_pre_data => 1, 995 }, 996 unlike => { 997 exclude_dump_test_schema => 1, 998 exclude_test_table => 1, 999 }, 1000 }, 1001 1002 'COMMENT ON COLUMN dump_test.composite.f1' => { 1003 create_order => 44, 1004 create_sql => 'COMMENT ON COLUMN dump_test.composite.f1 1005 IS \'comment on column of type\';', 1006 regexp => qr/^ 1007 \QCOMMENT ON COLUMN dump_test.composite.f1 IS 'comment on column of type';\E 1008 /xm, 1009 like => 1010 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1011 unlike => { exclude_dump_test_schema => 1, }, 1012 }, 1013 1014 'COMMENT ON COLUMN dump_test.test_second_table.col1' => { 1015 create_order => 63, 1016 create_sql => 'COMMENT ON COLUMN dump_test.test_second_table.col1 1017 IS \'comment on column col1\';', 1018 regexp => qr/^ 1019 \QCOMMENT ON COLUMN dump_test.test_second_table.col1 IS 'comment on column col1';\E 1020 /xm, 1021 like => 1022 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1023 unlike => { exclude_dump_test_schema => 1, }, 1024 }, 1025 1026 'COMMENT ON COLUMN dump_test.test_second_table.col2' => { 1027 create_order => 64, 1028 create_sql => 'COMMENT ON COLUMN dump_test.test_second_table.col2 1029 IS \'comment on column col2\';', 1030 regexp => qr/^ 1031 \QCOMMENT ON COLUMN dump_test.test_second_table.col2 IS 'comment on column col2';\E 1032 /xm, 1033 like => 1034 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1035 unlike => { exclude_dump_test_schema => 1, }, 1036 }, 1037 1038 'COMMENT ON CONVERSION dump_test.test_conversion' => { 1039 create_order => 79, 1040 create_sql => 'COMMENT ON CONVERSION dump_test.test_conversion 1041 IS \'comment on test conversion\';', 1042 regexp => 1043 qr/^COMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversion';/m, 1044 like => 1045 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1046 unlike => { exclude_dump_test_schema => 1, }, 1047 }, 1048 1049 'COMMENT ON COLLATION test0' => { 1050 create_order => 77, 1051 create_sql => 'COMMENT ON COLLATION test0 1052 IS \'comment on test0 collation\';', 1053 regexp => 1054 qr/^COMMENT ON COLLATION public.test0 IS 'comment on test0 collation';/m, 1055 collation => 1, 1056 like => { %full_runs, section_pre_data => 1, }, 1057 }, 1058 1059 'COMMENT ON LARGE OBJECT ...' => { 1060 create_order => 65, 1061 create_sql => 'DO $$ 1062 DECLARE myoid oid; 1063 BEGIN 1064 SELECT loid FROM pg_largeobject INTO myoid; 1065 EXECUTE \'COMMENT ON LARGE OBJECT \' || myoid || \' IS \'\'comment on large object\'\';\'; 1066 END; 1067 $$;', 1068 regexp => qr/^ 1069 \QCOMMENT ON LARGE OBJECT \E[0-9]+\Q IS 'comment on large object';\E 1070 /xm, 1071 like => { 1072 %full_runs, 1073 column_inserts => 1, 1074 data_only => 1, 1075 section_pre_data => 1, 1076 test_schema_plus_blobs => 1, 1077 }, 1078 unlike => { 1079 no_blobs => 1, 1080 schema_only => 1, 1081 }, 1082 }, 1083 1084 'COMMENT ON PUBLICATION pub1' => { 1085 create_order => 55, 1086 create_sql => 'COMMENT ON PUBLICATION pub1 1087 IS \'comment on publication\';', 1088 regexp => 1089 qr/^COMMENT ON PUBLICATION pub1 IS 'comment on publication';/m, 1090 like => { %full_runs, section_post_data => 1, }, 1091 }, 1092 1093 'COMMENT ON SUBSCRIPTION sub1' => { 1094 create_order => 55, 1095 create_sql => 'COMMENT ON SUBSCRIPTION sub1 1096 IS \'comment on subscription\';', 1097 regexp => 1098 qr/^COMMENT ON SUBSCRIPTION sub1 IS 'comment on subscription';/m, 1099 like => { %full_runs, section_post_data => 1, }, 1100 }, 1101 1102 'COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1' => { 1103 create_order => 84, 1104 create_sql => 1105 'COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 1106 IS \'comment on text search configuration\';', 1107 regexp => 1108 qr/^COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 IS 'comment on text search configuration';/m, 1109 like => 1110 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1111 unlike => { exclude_dump_test_schema => 1, }, 1112 }, 1113 1114 'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => { 1115 create_order => 84, 1116 create_sql => 1117 'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 1118 IS \'comment on text search dictionary\';', 1119 regexp => 1120 qr/^COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 IS 'comment on text search dictionary';/m, 1121 like => 1122 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1123 unlike => { exclude_dump_test_schema => 1, }, 1124 }, 1125 1126 'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1' => { 1127 create_order => 84, 1128 create_sql => 'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 1129 IS \'comment on text search parser\';', 1130 regexp => 1131 qr/^COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 IS 'comment on text search parser';/m, 1132 like => 1133 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1134 unlike => { exclude_dump_test_schema => 1, }, 1135 }, 1136 1137 'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => { 1138 create_order => 84, 1139 create_sql => 'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 1140 IS \'comment on text search template\';', 1141 regexp => 1142 qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text search template';/m, 1143 like => 1144 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1145 unlike => { exclude_dump_test_schema => 1, }, 1146 }, 1147 1148 'COMMENT ON TYPE dump_test.planets - ENUM' => { 1149 create_order => 68, 1150 create_sql => 'COMMENT ON TYPE dump_test.planets 1151 IS \'comment on enum type\';', 1152 regexp => 1153 qr/^COMMENT ON TYPE dump_test.planets IS 'comment on enum type';/m, 1154 like => 1155 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1156 unlike => { exclude_dump_test_schema => 1, }, 1157 }, 1158 1159 'COMMENT ON TYPE dump_test.textrange - RANGE' => { 1160 create_order => 69, 1161 create_sql => 'COMMENT ON TYPE dump_test.textrange 1162 IS \'comment on range type\';', 1163 regexp => 1164 qr/^COMMENT ON TYPE dump_test.textrange IS 'comment on range type';/m, 1165 like => 1166 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1167 unlike => { exclude_dump_test_schema => 1, }, 1168 }, 1169 1170 'COMMENT ON TYPE dump_test.int42 - Regular' => { 1171 create_order => 70, 1172 create_sql => 'COMMENT ON TYPE dump_test.int42 1173 IS \'comment on regular type\';', 1174 regexp => 1175 qr/^COMMENT ON TYPE dump_test.int42 IS 'comment on regular type';/m, 1176 like => 1177 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1178 unlike => { exclude_dump_test_schema => 1, }, 1179 }, 1180 1181 'COMMENT ON TYPE dump_test.undefined - Undefined' => { 1182 create_order => 71, 1183 create_sql => 'COMMENT ON TYPE dump_test.undefined 1184 IS \'comment on undefined type\';', 1185 regexp => 1186 qr/^COMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';/m, 1187 like => 1188 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1189 unlike => { exclude_dump_test_schema => 1, }, 1190 }, 1191 1192 'COPY test_table' => { 1193 create_order => 4, 1194 create_sql => 'INSERT INTO dump_test.test_table (col1) ' 1195 . 'SELECT generate_series FROM generate_series(1,9);', 1196 regexp => qr/^ 1197 \QCOPY dump_test.test_table (col1, col2, col3, col4) FROM stdin;\E 1198 \n(?:\d\t\\N\t\\N\t\\N\n){9}\\\.\n 1199 /xm, 1200 like => { 1201 %full_runs, 1202 %dump_test_schema_runs, 1203 data_only => 1, 1204 only_dump_test_table => 1, 1205 section_data => 1, 1206 }, 1207 unlike => { 1208 binary_upgrade => 1, 1209 exclude_dump_test_schema => 1, 1210 exclude_test_table => 1, 1211 exclude_test_table_data => 1, 1212 schema_only => 1, 1213 }, 1214 }, 1215 1216 'COPY fk_reference_test_table' => { 1217 create_order => 22, 1218 create_sql => 'INSERT INTO dump_test.fk_reference_test_table (col1) ' 1219 . 'SELECT generate_series FROM generate_series(1,5);', 1220 regexp => qr/^ 1221 \QCOPY dump_test.fk_reference_test_table (col1) FROM stdin;\E 1222 \n(?:\d\n){5}\\\.\n 1223 /xm, 1224 like => { 1225 %full_runs, 1226 %dump_test_schema_runs, 1227 data_only => 1, 1228 exclude_test_table => 1, 1229 exclude_test_table_data => 1, 1230 section_data => 1, 1231 }, 1232 unlike => { 1233 binary_upgrade => 1, 1234 exclude_dump_test_schema => 1, 1235 schema_only => 1, 1236 }, 1237 }, 1238 1239 # In a data-only dump, we try to actually order according to FKs, 1240 # so this check is just making sure that the referring table comes after 1241 # the referred-to table. 1242 'COPY fk_reference_test_table second' => { 1243 regexp => qr/^ 1244 \QCOPY dump_test.test_table (col1, col2, col3, col4) FROM stdin;\E 1245 \n(?:\d\t\\N\t\\N\t\\N\n){9}\\\.\n.* 1246 \QCOPY dump_test.fk_reference_test_table (col1) FROM stdin;\E 1247 \n(?:\d\n){5}\\\.\n 1248 /xms, 1249 like => { data_only => 1, }, 1250 }, 1251 1252 'COPY test_second_table' => { 1253 create_order => 7, 1254 create_sql => 'INSERT INTO dump_test.test_second_table (col1, col2) ' 1255 . 'SELECT generate_series, generate_series::text ' 1256 . 'FROM generate_series(1,9);', 1257 regexp => qr/^ 1258 \QCOPY dump_test.test_second_table (col1, col2) FROM stdin;\E 1259 \n(?:\d\t\d\n){9}\\\.\n 1260 /xm, 1261 like => { 1262 %full_runs, 1263 %dump_test_schema_runs, 1264 data_only => 1, 1265 section_data => 1, 1266 }, 1267 unlike => { 1268 binary_upgrade => 1, 1269 exclude_dump_test_schema => 1, 1270 schema_only => 1, 1271 }, 1272 }, 1273 1274 'COPY test_third_table' => { 1275 create_order => 12, 1276 create_sql => 1277 'INSERT INTO dump_test_second_schema.test_third_table (col1) ' 1278 . 'SELECT generate_series FROM generate_series(1,9);', 1279 regexp => qr/^ 1280 \QCOPY dump_test_second_schema.test_third_table (col1) FROM stdin;\E 1281 \n(?:\d\n){9}\\\.\n 1282 /xm, 1283 like => { 1284 %full_runs, 1285 data_only => 1, 1286 role => 1, 1287 section_data => 1, 1288 }, 1289 unlike => { 1290 binary_upgrade => 1, 1291 exclude_test_table_data => 1, 1292 schema_only => 1, 1293 with_oids => 1, 1294 }, 1295 }, 1296 1297 'COPY test_third_table WITH OIDS' => { 1298 regexp => qr/^ 1299 \QCOPY dump_test_second_schema.test_third_table (col1) WITH OIDS FROM stdin;\E 1300 \n(?:\d+\t\d\n){9}\\\.\n 1301 /xm, 1302 like => { with_oids => 1, }, 1303 }, 1304 1305 'COPY test_fourth_table' => { 1306 create_order => 7, 1307 create_sql => 1308 'INSERT INTO dump_test.test_fourth_table DEFAULT VALUES;', 1309 regexp => qr/^ 1310 \QCOPY dump_test.test_fourth_table FROM stdin;\E 1311 \n\n\\\.\n 1312 /xm, 1313 like => { 1314 %full_runs, 1315 %dump_test_schema_runs, 1316 data_only => 1, 1317 section_data => 1, 1318 }, 1319 unlike => { 1320 binary_upgrade => 1, 1321 exclude_dump_test_schema => 1, 1322 schema_only => 1, 1323 }, 1324 }, 1325 1326 'COPY test_fifth_table' => { 1327 create_order => 54, 1328 create_sql => 1329 'INSERT INTO dump_test.test_fifth_table VALUES (NULL, true, false, \'11001\'::bit(5), \'NaN\');', 1330 regexp => qr/^ 1331 \QCOPY dump_test.test_fifth_table (col1, col2, col3, col4, col5) FROM stdin;\E 1332 \n\\N\tt\tf\t11001\tNaN\n\\\.\n 1333 /xm, 1334 like => { 1335 %full_runs, 1336 %dump_test_schema_runs, 1337 data_only => 1, 1338 section_data => 1, 1339 }, 1340 unlike => { 1341 binary_upgrade => 1, 1342 exclude_dump_test_schema => 1, 1343 schema_only => 1, 1344 }, 1345 }, 1346 1347 'COPY test_table_identity' => { 1348 create_order => 54, 1349 create_sql => 1350 'INSERT INTO dump_test.test_table_identity (col2) VALUES (\'test\');', 1351 regexp => qr/^ 1352 \QCOPY dump_test.test_table_identity (col1, col2) FROM stdin;\E 1353 \n1\ttest\n\\\.\n 1354 /xm, 1355 like => { 1356 %full_runs, 1357 %dump_test_schema_runs, 1358 data_only => 1, 1359 section_data => 1, 1360 }, 1361 unlike => { 1362 binary_upgrade => 1, 1363 exclude_dump_test_schema => 1, 1364 schema_only => 1, 1365 }, 1366 }, 1367 1368 'INSERT INTO test_table' => { 1369 regexp => qr/^ 1370 (?:INSERT\ INTO\ dump_test.test_table\ \(col1,\ col2,\ col3,\ col4\)\ VALUES\ \(\d,\ NULL,\ NULL,\ NULL\);\n){9} 1371 /xm, 1372 like => { column_inserts => 1, }, 1373 }, 1374 1375 'INSERT INTO test_second_table' => { 1376 regexp => qr/^ 1377 (?:INSERT\ INTO\ dump_test.test_second_table\ \(col1,\ col2\) 1378 \ VALUES\ \(\d,\ '\d'\);\n){9}/xm, 1379 like => { column_inserts => 1, }, 1380 }, 1381 1382 'INSERT INTO test_third_table' => { 1383 regexp => qr/^ 1384 (?:INSERT\ INTO\ dump_test_second_schema.test_third_table\ \(col1\) 1385 \ VALUES\ \(\d\);\n){9}/xm, 1386 like => { column_inserts => 1, }, 1387 }, 1388 1389 'INSERT INTO test_fourth_table' => { 1390 regexp => 1391 qr/^\QINSERT INTO dump_test.test_fourth_table DEFAULT VALUES;\E/m, 1392 like => { column_inserts => 1, }, 1393 }, 1394 1395 'INSERT INTO test_fifth_table' => { 1396 regexp => 1397 qr/^\QINSERT INTO dump_test.test_fifth_table (col1, col2, col3, col4, col5) VALUES (NULL, true, false, B'11001', 'NaN');\E/m, 1398 like => { column_inserts => 1, }, 1399 }, 1400 1401 'INSERT INTO test_table_identity' => { 1402 regexp => 1403 qr/^\QINSERT INTO dump_test.test_table_identity (col1, col2) OVERRIDING SYSTEM VALUE VALUES (1, 'test');\E/m, 1404 like => { column_inserts => 1, }, 1405 }, 1406 1407 'CREATE ROLE regress_dump_test_role' => { 1408 create_order => 1, 1409 create_sql => 'CREATE ROLE regress_dump_test_role;', 1410 regexp => qr/^CREATE ROLE regress_dump_test_role;/m, 1411 like => { 1412 pg_dumpall_dbprivs => 1, 1413 pg_dumpall_globals => 1, 1414 pg_dumpall_globals_clean => 1, 1415 }, 1416 }, 1417 1418 'CREATE ACCESS METHOD gist2' => { 1419 create_order => 52, 1420 create_sql => 1421 'CREATE ACCESS METHOD gist2 TYPE INDEX HANDLER gisthandler;', 1422 regexp => 1423 qr/CREATE ACCESS METHOD gist2 TYPE INDEX HANDLER gisthandler;/m, 1424 like => { %full_runs, section_pre_data => 1, }, 1425 }, 1426 1427 'CREATE COLLATION test0 FROM "C"' => { 1428 create_order => 76, 1429 create_sql => 'CREATE COLLATION test0 FROM "C";', 1430 regexp => qr/^ 1431 \QCREATE COLLATION public.test0 (provider = libc, locale = 'C');\E/xm, 1432 collation => 1, 1433 like => { %full_runs, section_pre_data => 1, }, 1434 }, 1435 1436 'CREATE CAST FOR timestamptz' => { 1437 create_order => 51, 1438 create_sql => 1439 'CREATE CAST (timestamptz AS interval) WITH FUNCTION age(timestamptz) AS ASSIGNMENT;', 1440 regexp => 1441 qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog\.age\(timestamp with time zone\) AS ASSIGNMENT;/m, 1442 like => { %full_runs, section_pre_data => 1, }, 1443 }, 1444 1445 'CREATE DATABASE postgres' => { 1446 regexp => qr/^ 1447 \QCREATE DATABASE postgres WITH TEMPLATE = template0 \E 1448 .*;/xm, 1449 like => { createdb => 1, }, 1450 }, 1451 1452 'CREATE DATABASE dump_test' => { 1453 create_order => 47, 1454 create_sql => 'CREATE DATABASE dump_test;', 1455 regexp => qr/^ 1456 \QCREATE DATABASE dump_test WITH TEMPLATE = template0 \E 1457 .*;/xm, 1458 like => { pg_dumpall_dbprivs => 1, }, 1459 }, 1460 1461 'CREATE EXTENSION ... plpgsql' => { 1462 regexp => qr/^ 1463 \QCREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;\E 1464 /xm, 1465 1466 # this shouldn't ever get emitted anymore 1467 like => {}, 1468 }, 1469 1470 'CREATE AGGREGATE dump_test.newavg' => { 1471 create_order => 25, 1472 create_sql => 'CREATE AGGREGATE dump_test.newavg ( 1473 sfunc = int4_avg_accum, 1474 basetype = int4, 1475 stype = _int8, 1476 finalfunc = int8_avg, 1477 finalfunc_modify = shareable, 1478 initcond1 = \'{0,0}\' 1479 );', 1480 regexp => qr/^ 1481 \QCREATE AGGREGATE dump_test.newavg(integer) (\E 1482 \n\s+\QSFUNC = int4_avg_accum,\E 1483 \n\s+\QSTYPE = bigint[],\E 1484 \n\s+\QINITCOND = '{0,0}',\E 1485 \n\s+\QFINALFUNC = int8_avg,\E 1486 \n\s+\QFINALFUNC_MODIFY = SHAREABLE\E 1487 \n\);/xm, 1488 like => { 1489 %full_runs, 1490 %dump_test_schema_runs, 1491 exclude_test_table => 1, 1492 section_pre_data => 1, 1493 }, 1494 unlike => { exclude_dump_test_schema => 1, }, 1495 }, 1496 1497 'CREATE CONVERSION dump_test.test_conversion' => { 1498 create_order => 78, 1499 create_sql => 1500 'CREATE DEFAULT CONVERSION dump_test.test_conversion FOR \'LATIN1\' TO \'UTF8\' FROM iso8859_1_to_utf8;', 1501 regexp => 1502 qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;\E/xm, 1503 like => 1504 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1505 unlike => { exclude_dump_test_schema => 1, }, 1506 }, 1507 1508 'CREATE DOMAIN dump_test.us_postal_code' => { 1509 create_order => 29, 1510 create_sql => 'CREATE DOMAIN dump_test.us_postal_code AS TEXT 1511 COLLATE "C" 1512 DEFAULT \'10014\' 1513 CHECK(VALUE ~ \'^\d{5}$\' OR 1514 VALUE ~ \'^\d{5}-\d{4}$\');', 1515 regexp => qr/^ 1516 \QCREATE DOMAIN dump_test.us_postal_code AS text COLLATE pg_catalog."C" DEFAULT '10014'::text\E\n\s+ 1517 \QCONSTRAINT us_postal_code_check CHECK \E 1518 \Q(((VALUE ~ '^\d{5}\E 1519 \$\Q'::text) OR (VALUE ~ '^\d{5}-\d{4}\E\$ 1520 \Q'::text)));\E 1521 /xm, 1522 like => 1523 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1524 unlike => { exclude_dump_test_schema => 1, }, 1525 }, 1526 1527 'CREATE FUNCTION dump_test.pltestlang_call_handler' => { 1528 create_order => 17, 1529 create_sql => 'CREATE FUNCTION dump_test.pltestlang_call_handler() 1530 RETURNS LANGUAGE_HANDLER AS \'$libdir/plpgsql\', 1531 \'plpgsql_call_handler\' LANGUAGE C;', 1532 regexp => qr/^ 1533 \QCREATE FUNCTION dump_test.pltestlang_call_handler() \E 1534 \QRETURNS language_handler\E 1535 \n\s+\QLANGUAGE c\E 1536 \n\s+AS\ \'\$ 1537 \Qlibdir\/plpgsql', 'plpgsql_call_handler';\E 1538 /xm, 1539 like => 1540 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1541 unlike => { exclude_dump_test_schema => 1, }, 1542 }, 1543 1544 'CREATE FUNCTION dump_test.trigger_func' => { 1545 create_order => 30, 1546 create_sql => 'CREATE FUNCTION dump_test.trigger_func() 1547 RETURNS trigger LANGUAGE plpgsql 1548 AS $$ BEGIN RETURN NULL; END;$$;', 1549 regexp => qr/^ 1550 \QCREATE FUNCTION dump_test.trigger_func() RETURNS trigger\E 1551 \n\s+\QLANGUAGE plpgsql\E 1552 \n\s+AS\ \$\$ 1553 \Q BEGIN RETURN NULL; END;\E 1554 \$\$;/xm, 1555 like => 1556 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1557 unlike => { exclude_dump_test_schema => 1, }, 1558 }, 1559 1560 'CREATE FUNCTION dump_test.event_trigger_func' => { 1561 create_order => 32, 1562 create_sql => 'CREATE FUNCTION dump_test.event_trigger_func() 1563 RETURNS event_trigger LANGUAGE plpgsql 1564 AS $$ BEGIN RETURN; END;$$;', 1565 regexp => qr/^ 1566 \QCREATE FUNCTION dump_test.event_trigger_func() RETURNS event_trigger\E 1567 \n\s+\QLANGUAGE plpgsql\E 1568 \n\s+AS\ \$\$ 1569 \Q BEGIN RETURN; END;\E 1570 \$\$;/xm, 1571 like => 1572 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1573 unlike => { exclude_dump_test_schema => 1, }, 1574 }, 1575 1576 'CREATE OPERATOR FAMILY dump_test.op_family' => { 1577 create_order => 73, 1578 create_sql => 1579 'CREATE OPERATOR FAMILY dump_test.op_family USING btree;', 1580 regexp => qr/^ 1581 \QCREATE OPERATOR FAMILY dump_test.op_family USING btree;\E 1582 /xm, 1583 like => 1584 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1585 unlike => { exclude_dump_test_schema => 1, }, 1586 }, 1587 1588 'CREATE OPERATOR CLASS dump_test.op_class' => { 1589 create_order => 74, 1590 create_sql => 'CREATE OPERATOR CLASS dump_test.op_class 1591 FOR TYPE bigint USING btree FAMILY dump_test.op_family 1592 AS STORAGE bigint, 1593 OPERATOR 1 <(bigint,bigint), 1594 OPERATOR 2 <=(bigint,bigint), 1595 OPERATOR 3 =(bigint,bigint), 1596 OPERATOR 4 >=(bigint,bigint), 1597 OPERATOR 5 >(bigint,bigint), 1598 FUNCTION 1 btint8cmp(bigint,bigint), 1599 FUNCTION 2 btint8sortsupport(internal);', 1600 regexp => qr/^ 1601 \QCREATE OPERATOR CLASS dump_test.op_class\E\n\s+ 1602 \QFOR TYPE bigint USING btree FAMILY dump_test.op_family AS\E\n\s+ 1603 \QOPERATOR 1 <(bigint,bigint) ,\E\n\s+ 1604 \QOPERATOR 2 <=(bigint,bigint) ,\E\n\s+ 1605 \QOPERATOR 3 =(bigint,bigint) ,\E\n\s+ 1606 \QOPERATOR 4 >=(bigint,bigint) ,\E\n\s+ 1607 \QOPERATOR 5 >(bigint,bigint) ,\E\n\s+ 1608 \QFUNCTION 1 (bigint, bigint) btint8cmp(bigint,bigint) ,\E\n\s+ 1609 \QFUNCTION 2 (bigint, bigint) btint8sortsupport(internal);\E 1610 /xm, 1611 like => 1612 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1613 unlike => { exclude_dump_test_schema => 1, }, 1614 }, 1615 1616 'CREATE EVENT TRIGGER test_event_trigger' => { 1617 create_order => 33, 1618 create_sql => 'CREATE EVENT TRIGGER test_event_trigger 1619 ON ddl_command_start 1620 EXECUTE PROCEDURE dump_test.event_trigger_func();', 1621 regexp => qr/^ 1622 \QCREATE EVENT TRIGGER test_event_trigger \E 1623 \QON ddl_command_start\E 1624 \n\s+\QEXECUTE PROCEDURE dump_test.event_trigger_func();\E 1625 /xm, 1626 like => { %full_runs, section_post_data => 1, }, 1627 }, 1628 1629 'CREATE TRIGGER test_trigger' => { 1630 create_order => 31, 1631 create_sql => 'CREATE TRIGGER test_trigger 1632 BEFORE INSERT ON dump_test.test_table 1633 FOR EACH ROW WHEN (NEW.col1 > 10) 1634 EXECUTE PROCEDURE dump_test.trigger_func();', 1635 regexp => qr/^ 1636 \QCREATE TRIGGER test_trigger BEFORE INSERT ON dump_test.test_table \E 1637 \QFOR EACH ROW WHEN ((new.col1 > 10)) \E 1638 \QEXECUTE PROCEDURE dump_test.trigger_func();\E 1639 /xm, 1640 like => { 1641 %full_runs, 1642 %dump_test_schema_runs, 1643 only_dump_test_table => 1, 1644 section_post_data => 1, 1645 }, 1646 unlike => { 1647 exclude_test_table => 1, 1648 exclude_dump_test_schema => 1, 1649 }, 1650 }, 1651 1652 'CREATE TYPE dump_test.planets AS ENUM' => { 1653 create_order => 37, 1654 create_sql => 'CREATE TYPE dump_test.planets 1655 AS ENUM ( \'venus\', \'earth\', \'mars\' );', 1656 regexp => qr/^ 1657 \QCREATE TYPE dump_test.planets AS ENUM (\E 1658 \n\s+'venus', 1659 \n\s+'earth', 1660 \n\s+'mars' 1661 \n\);/xm, 1662 like => 1663 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1664 unlike => { 1665 binary_upgrade => 1, 1666 exclude_dump_test_schema => 1, 1667 }, 1668 }, 1669 1670 'CREATE TYPE dump_test.planets AS ENUM pg_upgrade' => { 1671 regexp => qr/^ 1672 \QCREATE TYPE dump_test.planets AS ENUM (\E 1673 \n\);.*^ 1674 \QALTER TYPE dump_test.planets ADD VALUE 'venus';\E 1675 \n.*^ 1676 \QALTER TYPE dump_test.planets ADD VALUE 'earth';\E 1677 \n.*^ 1678 \QALTER TYPE dump_test.planets ADD VALUE 'mars';\E 1679 \n/xms, 1680 like => { binary_upgrade => 1, }, 1681 }, 1682 1683 'CREATE TYPE dump_test.textrange AS RANGE' => { 1684 create_order => 38, 1685 create_sql => 'CREATE TYPE dump_test.textrange 1686 AS RANGE (subtype=text, collation="C");', 1687 regexp => qr/^ 1688 \QCREATE TYPE dump_test.textrange AS RANGE (\E 1689 \n\s+\Qsubtype = text,\E 1690 \n\s+\Qcollation = pg_catalog."C"\E 1691 \n\);/xm, 1692 like => 1693 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1694 unlike => { exclude_dump_test_schema => 1, }, 1695 }, 1696 1697 'CREATE TYPE dump_test.int42' => { 1698 create_order => 39, 1699 create_sql => 'CREATE TYPE dump_test.int42;', 1700 regexp => qr/^CREATE TYPE dump_test.int42;/m, 1701 like => 1702 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1703 unlike => { exclude_dump_test_schema => 1, }, 1704 }, 1705 1706 'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1' => { 1707 create_order => 80, 1708 create_sql => 1709 'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (copy=english);', 1710 regexp => qr/^ 1711 \QCREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (\E\n 1712 \s+\QPARSER = pg_catalog."default" );\E/xm, 1713 like => 1714 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1715 unlike => { exclude_dump_test_schema => 1, }, 1716 }, 1717 1718 'ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 ...' => { 1719 regexp => qr/^ 1720 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1721 \s+\QADD MAPPING FOR asciiword WITH english_stem;\E\n 1722 \n 1723 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1724 \s+\QADD MAPPING FOR word WITH english_stem;\E\n 1725 \n 1726 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1727 \s+\QADD MAPPING FOR numword WITH simple;\E\n 1728 \n 1729 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1730 \s+\QADD MAPPING FOR email WITH simple;\E\n 1731 \n 1732 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1733 \s+\QADD MAPPING FOR url WITH simple;\E\n 1734 \n 1735 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1736 \s+\QADD MAPPING FOR host WITH simple;\E\n 1737 \n 1738 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1739 \s+\QADD MAPPING FOR sfloat WITH simple;\E\n 1740 \n 1741 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1742 \s+\QADD MAPPING FOR version WITH simple;\E\n 1743 \n 1744 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1745 \s+\QADD MAPPING FOR hword_numpart WITH simple;\E\n 1746 \n 1747 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1748 \s+\QADD MAPPING FOR hword_part WITH english_stem;\E\n 1749 \n 1750 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1751 \s+\QADD MAPPING FOR hword_asciipart WITH english_stem;\E\n 1752 \n 1753 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1754 \s+\QADD MAPPING FOR numhword WITH simple;\E\n 1755 \n 1756 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1757 \s+\QADD MAPPING FOR asciihword WITH english_stem;\E\n 1758 \n 1759 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1760 \s+\QADD MAPPING FOR hword WITH english_stem;\E\n 1761 \n 1762 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1763 \s+\QADD MAPPING FOR url_path WITH simple;\E\n 1764 \n 1765 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1766 \s+\QADD MAPPING FOR file WITH simple;\E\n 1767 \n 1768 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1769 \s+\QADD MAPPING FOR "float" WITH simple;\E\n 1770 \n 1771 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1772 \s+\QADD MAPPING FOR "int" WITH simple;\E\n 1773 \n 1774 \QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n 1775 \s+\QADD MAPPING FOR uint WITH simple;\E\n 1776 \n 1777 /xm, 1778 like => 1779 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1780 unlike => { exclude_dump_test_schema => 1, }, 1781 }, 1782 1783 'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => { 1784 create_order => 81, 1785 create_sql => 1786 'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (lexize=dsimple_lexize);', 1787 regexp => qr/^ 1788 \QCREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (\E\n 1789 \s+\QLEXIZE = dsimple_lexize );\E/xm, 1790 like => 1791 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1792 unlike => { exclude_dump_test_schema => 1, }, 1793 }, 1794 1795 'CREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1' => { 1796 create_order => 82, 1797 create_sql => 'CREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1 1798 (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);', 1799 regexp => qr/^ 1800 \QCREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1 (\E\n 1801 \s+\QSTART = prsd_start,\E\n 1802 \s+\QGETTOKEN = prsd_nexttoken,\E\n 1803 \s+\QEND = prsd_end,\E\n 1804 \s+\QLEXTYPES = prsd_lextype );\E\n 1805 /xm, 1806 like => 1807 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1808 unlike => { exclude_dump_test_schema => 1, }, 1809 }, 1810 1811 'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => { 1812 create_order => 83, 1813 create_sql => 1814 'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (template=simple);', 1815 regexp => qr/^ 1816 \QCREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (\E\n 1817 \s+\QTEMPLATE = pg_catalog.simple );\E\n 1818 /xm, 1819 like => 1820 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1821 unlike => { exclude_dump_test_schema => 1, }, 1822 }, 1823 1824 'CREATE FUNCTION dump_test.int42_in' => { 1825 create_order => 40, 1826 create_sql => 'CREATE FUNCTION dump_test.int42_in(cstring) 1827 RETURNS dump_test.int42 AS \'int4in\' 1828 LANGUAGE internal STRICT IMMUTABLE;', 1829 regexp => qr/^ 1830 \QCREATE FUNCTION dump_test.int42_in(cstring) RETURNS dump_test.int42\E 1831 \n\s+\QLANGUAGE internal IMMUTABLE STRICT\E 1832 \n\s+AS\ \$\$int4in\$\$; 1833 /xm, 1834 like => 1835 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1836 unlike => { exclude_dump_test_schema => 1, }, 1837 }, 1838 1839 'CREATE FUNCTION dump_test.int42_out' => { 1840 create_order => 41, 1841 create_sql => 'CREATE FUNCTION dump_test.int42_out(dump_test.int42) 1842 RETURNS cstring AS \'int4out\' 1843 LANGUAGE internal STRICT IMMUTABLE;', 1844 regexp => qr/^ 1845 \QCREATE FUNCTION dump_test.int42_out(dump_test.int42) RETURNS cstring\E 1846 \n\s+\QLANGUAGE internal IMMUTABLE STRICT\E 1847 \n\s+AS\ \$\$int4out\$\$; 1848 /xm, 1849 like => 1850 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1851 unlike => { exclude_dump_test_schema => 1, }, 1852 }, 1853 1854 'CREATE PROCEDURE dump_test.ptest1' => { 1855 create_order => 41, 1856 create_sql => 'CREATE PROCEDURE dump_test.ptest1(a int) 1857 LANGUAGE SQL AS $$ INSERT INTO dump_test.test_table (col1) VALUES (a) $$;', 1858 regexp => qr/^ 1859 \QCREATE PROCEDURE dump_test.ptest1(a integer)\E 1860 \n\s+\QLANGUAGE sql\E 1861 \n\s+AS\ \$\$\Q INSERT INTO dump_test.test_table (col1) VALUES (a) \E\$\$; 1862 /xm, 1863 like => 1864 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1865 unlike => { exclude_dump_test_schema => 1, }, 1866 }, 1867 1868 'CREATE TYPE dump_test.int42 populated' => { 1869 create_order => 42, 1870 create_sql => 'CREATE TYPE dump_test.int42 ( 1871 internallength = 4, 1872 input = dump_test.int42_in, 1873 output = dump_test.int42_out, 1874 alignment = int4, 1875 default = 42, 1876 passedbyvalue);', 1877 regexp => qr/^ 1878 \QCREATE TYPE dump_test.int42 (\E 1879 \n\s+\QINTERNALLENGTH = 4,\E 1880 \n\s+\QINPUT = dump_test.int42_in,\E 1881 \n\s+\QOUTPUT = dump_test.int42_out,\E 1882 \n\s+\QDEFAULT = '42',\E 1883 \n\s+\QALIGNMENT = int4,\E 1884 \n\s+\QSTORAGE = plain,\E 1885 \n\s+PASSEDBYVALUE\n\); 1886 /xm, 1887 like => 1888 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1889 unlike => { exclude_dump_test_schema => 1, }, 1890 }, 1891 1892 'CREATE TYPE dump_test.composite' => { 1893 create_order => 43, 1894 create_sql => 'CREATE TYPE dump_test.composite AS ( 1895 f1 int, 1896 f2 dump_test.int42 1897 );', 1898 regexp => qr/^ 1899 \QCREATE TYPE dump_test.composite AS (\E 1900 \n\s+\Qf1 integer,\E 1901 \n\s+\Qf2 dump_test.int42\E 1902 \n\); 1903 /xm, 1904 like => 1905 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1906 unlike => { exclude_dump_test_schema => 1, }, 1907 }, 1908 1909 'CREATE TYPE dump_test.undefined' => { 1910 create_order => 39, 1911 create_sql => 'CREATE TYPE dump_test.undefined;', 1912 regexp => qr/^CREATE TYPE dump_test.undefined;/m, 1913 like => 1914 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1915 unlike => { exclude_dump_test_schema => 1, }, 1916 }, 1917 1918 'CREATE FOREIGN DATA WRAPPER dummy' => { 1919 create_order => 35, 1920 create_sql => 'CREATE FOREIGN DATA WRAPPER dummy;', 1921 regexp => qr/CREATE FOREIGN DATA WRAPPER dummy;/m, 1922 like => { %full_runs, section_pre_data => 1, }, 1923 }, 1924 1925 'CREATE SERVER s1 FOREIGN DATA WRAPPER dummy' => { 1926 create_order => 36, 1927 create_sql => 'CREATE SERVER s1 FOREIGN DATA WRAPPER dummy;', 1928 regexp => qr/CREATE SERVER s1 FOREIGN DATA WRAPPER dummy;/m, 1929 like => { %full_runs, section_pre_data => 1, }, 1930 }, 1931 1932 'CREATE FOREIGN TABLE dump_test.foreign_table SERVER s1' => { 1933 create_order => 88, 1934 create_sql => 1935 'CREATE FOREIGN TABLE dump_test.foreign_table (c1 int options (column_name \'col1\')) 1936 SERVER s1 OPTIONS (schema_name \'x1\');', 1937 regexp => qr/ 1938 \QCREATE FOREIGN TABLE dump_test.foreign_table (\E\n 1939 \s+\Qc1 integer\E\n 1940 \Q)\E\n 1941 \QSERVER s1\E\n 1942 \QOPTIONS (\E\n 1943 \s+\Qschema_name 'x1'\E\n 1944 \Q);\E\n 1945 /xm, 1946 like => 1947 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1948 unlike => { exclude_dump_test_schema => 1, }, 1949 }, 1950 1951 'CREATE USER MAPPING FOR regress_dump_test_role SERVER s1' => { 1952 create_order => 86, 1953 create_sql => 1954 'CREATE USER MAPPING FOR regress_dump_test_role SERVER s1;', 1955 regexp => 1956 qr/CREATE USER MAPPING FOR regress_dump_test_role SERVER s1;/m, 1957 like => { %full_runs, section_pre_data => 1, }, 1958 }, 1959 1960 'CREATE TRANSFORM FOR int' => { 1961 create_order => 34, 1962 create_sql => 1963 'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION prsd_lextype(internal), TO SQL WITH FUNCTION int4recv(internal));', 1964 regexp => 1965 qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog\.prsd_lextype\(internal\), TO SQL WITH FUNCTION pg_catalog\.int4recv\(internal\)\);/m, 1966 like => { %full_runs, section_pre_data => 1, }, 1967 }, 1968 1969 'CREATE LANGUAGE pltestlang' => { 1970 create_order => 18, 1971 create_sql => 'CREATE LANGUAGE pltestlang 1972 HANDLER dump_test.pltestlang_call_handler;', 1973 regexp => qr/^ 1974 \QCREATE PROCEDURAL LANGUAGE pltestlang \E 1975 \QHANDLER dump_test.pltestlang_call_handler;\E 1976 /xm, 1977 like => { %full_runs, section_pre_data => 1, }, 1978 unlike => { exclude_dump_test_schema => 1, }, 1979 }, 1980 1981 'CREATE MATERIALIZED VIEW matview' => { 1982 create_order => 20, 1983 create_sql => 'CREATE MATERIALIZED VIEW dump_test.matview (col1) AS 1984 SELECT col1 FROM dump_test.test_table;', 1985 regexp => qr/^ 1986 \QCREATE MATERIALIZED VIEW dump_test.matview AS\E 1987 \n\s+\QSELECT test_table.col1\E 1988 \n\s+\QFROM dump_test.test_table\E 1989 \n\s+\QWITH NO DATA;\E 1990 /xm, 1991 like => 1992 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 1993 unlike => { exclude_dump_test_schema => 1, }, 1994 }, 1995 1996 'CREATE MATERIALIZED VIEW matview_second' => { 1997 create_order => 21, 1998 create_sql => 'CREATE MATERIALIZED VIEW 1999 dump_test.matview_second (col1) AS 2000 SELECT * FROM dump_test.matview;', 2001 regexp => qr/^ 2002 \QCREATE MATERIALIZED VIEW dump_test.matview_second AS\E 2003 \n\s+\QSELECT matview.col1\E 2004 \n\s+\QFROM dump_test.matview\E 2005 \n\s+\QWITH NO DATA;\E 2006 /xm, 2007 like => 2008 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2009 unlike => { exclude_dump_test_schema => 1, }, 2010 }, 2011 2012 'CREATE MATERIALIZED VIEW matview_third' => { 2013 create_order => 58, 2014 create_sql => 'CREATE MATERIALIZED VIEW 2015 dump_test.matview_third (col1) AS 2016 SELECT * FROM dump_test.matview_second WITH NO DATA;', 2017 regexp => qr/^ 2018 \QCREATE MATERIALIZED VIEW dump_test.matview_third AS\E 2019 \n\s+\QSELECT matview_second.col1\E 2020 \n\s+\QFROM dump_test.matview_second\E 2021 \n\s+\QWITH NO DATA;\E 2022 /xm, 2023 like => 2024 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2025 unlike => { exclude_dump_test_schema => 1, }, 2026 }, 2027 2028 'CREATE MATERIALIZED VIEW matview_fourth' => { 2029 create_order => 59, 2030 create_sql => 'CREATE MATERIALIZED VIEW 2031 dump_test.matview_fourth (col1) AS 2032 SELECT * FROM dump_test.matview_third WITH NO DATA;', 2033 regexp => qr/^ 2034 \QCREATE MATERIALIZED VIEW dump_test.matview_fourth AS\E 2035 \n\s+\QSELECT matview_third.col1\E 2036 \n\s+\QFROM dump_test.matview_third\E 2037 \n\s+\QWITH NO DATA;\E 2038 /xm, 2039 like => 2040 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2041 unlike => { exclude_dump_test_schema => 1, }, 2042 }, 2043 2044 'CREATE POLICY p1 ON test_table' => { 2045 create_order => 22, 2046 create_sql => 'CREATE POLICY p1 ON dump_test.test_table 2047 USING (true) 2048 WITH CHECK (true);', 2049 regexp => qr/^ 2050 \QCREATE POLICY p1 ON dump_test.test_table \E 2051 \QUSING (true) WITH CHECK (true);\E 2052 /xm, 2053 like => { 2054 %full_runs, 2055 %dump_test_schema_runs, 2056 only_dump_test_table => 1, 2057 section_post_data => 1, 2058 }, 2059 unlike => { 2060 exclude_dump_test_schema => 1, 2061 exclude_test_table => 1, 2062 }, 2063 }, 2064 2065 'CREATE POLICY p2 ON test_table FOR SELECT' => { 2066 create_order => 24, 2067 create_sql => 'CREATE POLICY p2 ON dump_test.test_table 2068 FOR SELECT TO regress_dump_test_role USING (true);', 2069 regexp => qr/^ 2070 \QCREATE POLICY p2 ON dump_test.test_table FOR SELECT TO regress_dump_test_role \E 2071 \QUSING (true);\E 2072 /xm, 2073 like => { 2074 %full_runs, 2075 %dump_test_schema_runs, 2076 only_dump_test_table => 1, 2077 section_post_data => 1, 2078 }, 2079 unlike => { 2080 exclude_dump_test_schema => 1, 2081 exclude_test_table => 1, 2082 }, 2083 }, 2084 2085 'CREATE POLICY p3 ON test_table FOR INSERT' => { 2086 create_order => 25, 2087 create_sql => 'CREATE POLICY p3 ON dump_test.test_table 2088 FOR INSERT TO regress_dump_test_role WITH CHECK (true);', 2089 regexp => qr/^ 2090 \QCREATE POLICY p3 ON dump_test.test_table FOR INSERT \E 2091 \QTO regress_dump_test_role WITH CHECK (true);\E 2092 /xm, 2093 like => { 2094 %full_runs, 2095 %dump_test_schema_runs, 2096 only_dump_test_table => 1, 2097 section_post_data => 1, 2098 }, 2099 unlike => { 2100 exclude_dump_test_schema => 1, 2101 exclude_test_table => 1, 2102 }, 2103 }, 2104 2105 'CREATE POLICY p4 ON test_table FOR UPDATE' => { 2106 create_order => 26, 2107 create_sql => 'CREATE POLICY p4 ON dump_test.test_table FOR UPDATE 2108 TO regress_dump_test_role USING (true) WITH CHECK (true);', 2109 regexp => qr/^ 2110 \QCREATE POLICY p4 ON dump_test.test_table FOR UPDATE TO regress_dump_test_role \E 2111 \QUSING (true) WITH CHECK (true);\E 2112 /xm, 2113 like => { 2114 %full_runs, 2115 %dump_test_schema_runs, 2116 only_dump_test_table => 1, 2117 section_post_data => 1, 2118 }, 2119 unlike => { 2120 exclude_dump_test_schema => 1, 2121 exclude_test_table => 1, 2122 }, 2123 }, 2124 2125 'CREATE POLICY p5 ON test_table FOR DELETE' => { 2126 create_order => 27, 2127 create_sql => 'CREATE POLICY p5 ON dump_test.test_table 2128 FOR DELETE TO regress_dump_test_role USING (true);', 2129 regexp => qr/^ 2130 \QCREATE POLICY p5 ON dump_test.test_table FOR DELETE \E 2131 \QTO regress_dump_test_role USING (true);\E 2132 /xm, 2133 like => { 2134 %full_runs, 2135 %dump_test_schema_runs, 2136 only_dump_test_table => 1, 2137 section_post_data => 1, 2138 }, 2139 unlike => { 2140 exclude_dump_test_schema => 1, 2141 exclude_test_table => 1, 2142 }, 2143 }, 2144 2145 'CREATE POLICY p6 ON test_table AS RESTRICTIVE' => { 2146 create_order => 27, 2147 create_sql => 'CREATE POLICY p6 ON dump_test.test_table AS RESTRICTIVE 2148 USING (false);', 2149 regexp => qr/^ 2150 \QCREATE POLICY p6 ON dump_test.test_table AS RESTRICTIVE \E 2151 \QUSING (false);\E 2152 /xm, 2153 like => { 2154 %full_runs, 2155 %dump_test_schema_runs, 2156 only_dump_test_table => 1, 2157 section_post_data => 1, 2158 }, 2159 unlike => { 2160 exclude_dump_test_schema => 1, 2161 exclude_test_table => 1, 2162 }, 2163 }, 2164 2165 'CREATE PUBLICATION pub1' => { 2166 create_order => 50, 2167 create_sql => 'CREATE PUBLICATION pub1;', 2168 regexp => qr/^ 2169 \QCREATE PUBLICATION pub1 WITH (publish = 'insert, update, delete, truncate');\E 2170 /xm, 2171 like => { %full_runs, section_post_data => 1, }, 2172 }, 2173 2174 'CREATE PUBLICATION pub2' => { 2175 create_order => 50, 2176 create_sql => 'CREATE PUBLICATION pub2 2177 FOR ALL TABLES 2178 WITH (publish = \'\');', 2179 regexp => qr/^ 2180 \QCREATE PUBLICATION pub2 FOR ALL TABLES WITH (publish = '');\E 2181 /xm, 2182 like => { %full_runs, section_post_data => 1, }, 2183 }, 2184 2185 'CREATE SUBSCRIPTION sub1' => { 2186 create_order => 50, 2187 create_sql => 'CREATE SUBSCRIPTION sub1 2188 CONNECTION \'dbname=doesnotexist\' PUBLICATION pub1 2189 WITH (connect = false);', 2190 regexp => qr/^ 2191 \QCREATE SUBSCRIPTION sub1 CONNECTION 'dbname=doesnotexist' PUBLICATION pub1 WITH (connect = false, slot_name = 'sub1');\E 2192 /xm, 2193 like => { %full_runs, section_post_data => 1, }, 2194 }, 2195 2196 'ALTER PUBLICATION pub1 ADD TABLE test_table' => { 2197 create_order => 51, 2198 create_sql => 2199 'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_table;', 2200 regexp => qr/^ 2201 \QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_table;\E 2202 /xm, 2203 like => { %full_runs, section_post_data => 1, }, 2204 unlike => { 2205 exclude_dump_test_schema => 1, 2206 exclude_test_table => 1, 2207 }, 2208 }, 2209 2210 'ALTER PUBLICATION pub1 ADD TABLE test_second_table' => { 2211 create_order => 52, 2212 create_sql => 2213 'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_second_table;', 2214 regexp => qr/^ 2215 \QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_second_table;\E 2216 /xm, 2217 like => { %full_runs, section_post_data => 1, }, 2218 unlike => { exclude_dump_test_schema => 1, }, 2219 }, 2220 2221 'CREATE SCHEMA public' => { 2222 regexp => qr/^CREATE SCHEMA public;/m, 2223 2224 # this shouldn't ever get emitted anymore 2225 like => {}, 2226 }, 2227 2228 'CREATE SCHEMA dump_test' => { 2229 create_order => 2, 2230 create_sql => 'CREATE SCHEMA dump_test;', 2231 regexp => qr/^CREATE SCHEMA dump_test;/m, 2232 like => 2233 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2234 unlike => { exclude_dump_test_schema => 1, }, 2235 }, 2236 2237 'CREATE SCHEMA dump_test_second_schema' => { 2238 create_order => 9, 2239 create_sql => 'CREATE SCHEMA dump_test_second_schema;', 2240 regexp => qr/^CREATE SCHEMA dump_test_second_schema;/m, 2241 like => { 2242 %full_runs, 2243 role => 1, 2244 section_pre_data => 1, 2245 }, 2246 }, 2247 2248 'CREATE TABLE test_table' => { 2249 create_order => 3, 2250 create_sql => 'CREATE TABLE dump_test.test_table ( 2251 col1 serial primary key, 2252 col2 text, 2253 col3 text, 2254 col4 text, 2255 CHECK (col1 <= 1000) 2256 ) WITH (autovacuum_enabled = false, fillfactor=80);', 2257 regexp => qr/^ 2258 \QCREATE TABLE dump_test.test_table (\E\n 2259 \s+\Qcol1 integer NOT NULL,\E\n 2260 \s+\Qcol2 text,\E\n 2261 \s+\Qcol3 text,\E\n 2262 \s+\Qcol4 text,\E\n 2263 \s+\QCONSTRAINT test_table_col1_check CHECK ((col1 <= 1000))\E\n 2264 \Q)\E\n 2265 \QWITH (autovacuum_enabled='false', fillfactor='80');\E\n/xm, 2266 like => { 2267 %full_runs, 2268 %dump_test_schema_runs, 2269 only_dump_test_table => 1, 2270 section_pre_data => 1, 2271 }, 2272 unlike => { 2273 exclude_dump_test_schema => 1, 2274 exclude_test_table => 1, 2275 }, 2276 }, 2277 2278 'CREATE TABLE fk_reference_test_table' => { 2279 create_order => 21, 2280 create_sql => 'CREATE TABLE dump_test.fk_reference_test_table ( 2281 col1 int primary key references dump_test.test_table 2282 );', 2283 regexp => qr/^ 2284 \QCREATE TABLE dump_test.fk_reference_test_table (\E 2285 \n\s+\Qcol1 integer NOT NULL\E 2286 \n\); 2287 /xm, 2288 like => 2289 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2290 unlike => { exclude_dump_test_schema => 1, }, 2291 }, 2292 2293 'CREATE TABLE test_second_table' => { 2294 create_order => 6, 2295 create_sql => 'CREATE TABLE dump_test.test_second_table ( 2296 col1 int, 2297 col2 text 2298 );', 2299 regexp => qr/^ 2300 \QCREATE TABLE dump_test.test_second_table (\E 2301 \n\s+\Qcol1 integer,\E 2302 \n\s+\Qcol2 text\E 2303 \n\); 2304 /xm, 2305 like => 2306 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2307 unlike => { exclude_dump_test_schema => 1, }, 2308 }, 2309 2310 'CREATE UNLOGGED TABLE test_third_table WITH OIDS' => { 2311 create_order => 11, 2312 create_sql => 2313 'CREATE UNLOGGED TABLE dump_test_second_schema.test_third_table ( 2314 col1 serial 2315 ) WITH OIDS;', 2316 regexp => qr/^ 2317 \QSET default_with_oids = true;\E\n\n 2318 \Q--\E\n 2319 (\Q-- TOC entry \E[0-9]+\ \(class\ 1259\ OID\ [0-9]+\)\n)? 2320 \Q-- Name: test_third_table;\E.*\n 2321 \Q--\E\n\n 2322 \QCREATE UNLOGGED TABLE dump_test_second_schema.test_third_table (\E 2323 \n\s+\Qcol1 integer NOT NULL\E 2324 \n\);\n 2325 /xm, 2326 like => { 2327 %full_runs, 2328 role => 1, 2329 section_pre_data => 1, 2330 }, 2331 unlike => { 2332 2333 # FIXME figure out why/how binary upgrade drops OIDs. 2334 binary_upgrade => 1, 2335 }, 2336 }, 2337 2338 'CREATE TABLE measurement PARTITIONED BY' => { 2339 create_order => 90, 2340 create_sql => 'CREATE TABLE dump_test.measurement ( 2341 city_id serial not null, 2342 logdate date not null, 2343 peaktemp int CHECK (peaktemp >= -460), 2344 unitsales int 2345 ) PARTITION BY RANGE (logdate);', 2346 regexp => qr/^ 2347 \Q-- Name: measurement;\E.*\n 2348 \Q--\E\n\n 2349 \QCREATE TABLE dump_test.measurement (\E\n 2350 \s+\Qcity_id integer NOT NULL,\E\n 2351 \s+\Qlogdate date NOT NULL,\E\n 2352 \s+\Qpeaktemp integer,\E\n 2353 \s+\Qunitsales integer,\E\n 2354 \s+\QCONSTRAINT measurement_peaktemp_check CHECK ((peaktemp >= '-460'::integer))\E\n 2355 \)\n 2356 \QPARTITION BY RANGE (logdate);\E\n 2357 /xm, 2358 like => 2359 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2360 unlike => { 2361 binary_upgrade => 1, 2362 exclude_dump_test_schema => 1, 2363 }, 2364 }, 2365 2366 'Partition measurement_y2006m2 creation' => { 2367 create_order => 91, 2368 create_sql => 2369 'CREATE TABLE dump_test_second_schema.measurement_y2006m2 2370 PARTITION OF dump_test.measurement ( 2371 unitsales DEFAULT 0 CHECK (unitsales >= 0) 2372 ) 2373 FOR VALUES FROM (\'2006-02-01\') TO (\'2006-03-01\');', 2374 regexp => qr/^ 2375 \QCREATE TABLE dump_test_second_schema.measurement_y2006m2 (\E\n 2376 \s+\Qcity_id integer DEFAULT nextval('dump_test.measurement_city_id_seq'::regclass) NOT NULL,\E\n 2377 \s+\Qlogdate date NOT NULL,\E\n 2378 \s+\Qpeaktemp integer,\E\n 2379 \s+\Qunitsales integer DEFAULT 0,\E\n 2380 \s+\QCONSTRAINT measurement_peaktemp_check CHECK ((peaktemp >= '-460'::integer)),\E\n 2381 \s+\QCONSTRAINT measurement_y2006m2_unitsales_check CHECK ((unitsales >= 0))\E\n 2382 \);\n 2383 /xm, 2384 like => { 2385 %full_runs, 2386 section_pre_data => 1, 2387 role => 1, 2388 binary_upgrade => 1, 2389 }, 2390 }, 2391 2392 'Creation of row-level trigger in partitioned table' => { 2393 create_order => 92, 2394 create_sql => 'CREATE TRIGGER test_trigger 2395 AFTER INSERT ON dump_test.measurement 2396 FOR EACH ROW EXECUTE PROCEDURE dump_test.trigger_func()', 2397 regexp => qr/^ 2398 \QCREATE TRIGGER test_trigger AFTER INSERT ON dump_test.measurement \E 2399 \QFOR EACH ROW \E 2400 \QEXECUTE PROCEDURE dump_test.trigger_func();\E 2401 /xm, 2402 like => { 2403 %full_runs, %dump_test_schema_runs, section_post_data => 1, 2404 }, 2405 unlike => { 2406 exclude_dump_test_schema => 1, 2407 }, 2408 }, 2409 2410 'Disabled trigger on partition is altered' => { 2411 create_order => 93, 2412 create_sql => 2413 'CREATE TABLE dump_test_second_schema.measurement_y2006m3 2414 PARTITION OF dump_test.measurement 2415 FOR VALUES FROM (\'2006-03-01\') TO (\'2006-04-01\'); 2416 ALTER TABLE dump_test_second_schema.measurement_y2006m3 DISABLE TRIGGER test_trigger; 2417 CREATE TABLE dump_test_second_schema.measurement_y2006m4 2418 PARTITION OF dump_test.measurement 2419 FOR VALUES FROM (\'2006-04-01\') TO (\'2006-05-01\'); 2420 ALTER TABLE dump_test_second_schema.measurement_y2006m4 ENABLE REPLICA TRIGGER test_trigger; 2421 CREATE TABLE dump_test_second_schema.measurement_y2006m5 2422 PARTITION OF dump_test.measurement 2423 FOR VALUES FROM (\'2006-05-01\') TO (\'2006-06-01\'); 2424 ALTER TABLE dump_test_second_schema.measurement_y2006m5 ENABLE ALWAYS TRIGGER test_trigger; 2425 ', 2426 regexp => qr/^ 2427 \QALTER TABLE dump_test_second_schema.measurement_y2006m3 DISABLE TRIGGER test_trigger;\E 2428 /xm, 2429 like => { 2430 %full_runs, 2431 section_post_data => 1, 2432 role => 1, 2433 binary_upgrade => 1, 2434 }, 2435 }, 2436 2437 'Replica trigger on partition is altered' => { 2438 regexp => qr/^ 2439 \QALTER TABLE dump_test_second_schema.measurement_y2006m4 ENABLE REPLICA TRIGGER test_trigger;\E 2440 /xm, 2441 like => { 2442 %full_runs, 2443 section_post_data => 1, 2444 role => 1, 2445 binary_upgrade => 1, 2446 }, 2447 }, 2448 2449 'Always trigger on partition is altered' => { 2450 regexp => qr/^ 2451 \QALTER TABLE dump_test_second_schema.measurement_y2006m5 ENABLE ALWAYS TRIGGER test_trigger;\E 2452 /xm, 2453 like => { 2454 %full_runs, 2455 section_post_data => 1, 2456 role => 1, 2457 binary_upgrade => 1, 2458 }, 2459 }, 2460 2461 # We should never see the creation of a trigger on a partition 2462 'Disabled trigger on partition is not created' => { 2463 regexp => qr/CREATE TRIGGER test_trigger.*ON dump_test_second_schema/, 2464 like => {}, 2465 unlike => { %full_runs, %dump_test_schema_runs }, 2466 }, 2467 2468 # Triggers on partitions should not be dropped individually 2469 'Triggers on partitions are not dropped' => { 2470 regexp => qr/DROP TRIGGER test_trigger.*ON dump_test_second_schema/, 2471 like => {} 2472 }, 2473 2474 'CREATE TABLE test_fourth_table_zero_col' => { 2475 create_order => 6, 2476 create_sql => 'CREATE TABLE dump_test.test_fourth_table ( 2477 );', 2478 regexp => qr/^ 2479 \QCREATE TABLE dump_test.test_fourth_table (\E 2480 \n\); 2481 /xm, 2482 like => 2483 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2484 unlike => { exclude_dump_test_schema => 1, }, 2485 }, 2486 2487 'CREATE TABLE test_fifth_table' => { 2488 create_order => 53, 2489 create_sql => 'CREATE TABLE dump_test.test_fifth_table ( 2490 col1 integer, 2491 col2 boolean, 2492 col3 boolean, 2493 col4 bit(5), 2494 col5 float8 2495 );', 2496 regexp => qr/^ 2497 \QCREATE TABLE dump_test.test_fifth_table (\E 2498 \n\s+\Qcol1 integer,\E 2499 \n\s+\Qcol2 boolean,\E 2500 \n\s+\Qcol3 boolean,\E 2501 \n\s+\Qcol4 bit(5),\E 2502 \n\s+\Qcol5 double precision\E 2503 \n\); 2504 /xm, 2505 like => 2506 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2507 unlike => { exclude_dump_test_schema => 1, }, 2508 }, 2509 2510 'CREATE TABLE test_table_identity' => { 2511 create_order => 3, 2512 create_sql => 'CREATE TABLE dump_test.test_table_identity ( 2513 col1 int generated always as identity primary key, 2514 col2 text 2515 );', 2516 regexp => qr/^ 2517 \QCREATE TABLE dump_test.test_table_identity (\E\n 2518 \s+\Qcol1 integer NOT NULL,\E\n 2519 \s+\Qcol2 text\E\n 2520 \); 2521 .* 2522 \QALTER TABLE dump_test.test_table_identity ALTER COLUMN col1 ADD GENERATED ALWAYS AS IDENTITY (\E\n 2523 \s+\QSEQUENCE NAME dump_test.test_table_identity_col1_seq\E\n 2524 \s+\QSTART WITH 1\E\n 2525 \s+\QINCREMENT BY 1\E\n 2526 \s+\QNO MINVALUE\E\n 2527 \s+\QNO MAXVALUE\E\n 2528 \s+\QCACHE 1\E\n 2529 \); 2530 /xms, 2531 like => 2532 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2533 unlike => { exclude_dump_test_schema => 1, }, 2534 }, 2535 2536 'CREATE TABLE table_with_stats' => { 2537 create_order => 98, 2538 create_sql => 'CREATE TABLE dump_test.table_index_stats ( 2539 col1 int, 2540 col2 int, 2541 col3 int); 2542 CREATE INDEX index_with_stats 2543 ON dump_test.table_index_stats 2544 ((col1 + 1), col1, (col2 + 1), (col3 + 1)); 2545 ALTER INDEX dump_test.index_with_stats 2546 ALTER COLUMN 1 SET STATISTICS 400; 2547 ALTER INDEX dump_test.index_with_stats 2548 ALTER COLUMN 3 SET STATISTICS 500;', 2549 regexp => qr/^ 2550 \QALTER INDEX dump_test.index_with_stats ALTER COLUMN 1 SET STATISTICS 400;\E\n 2551 \QALTER INDEX dump_test.index_with_stats ALTER COLUMN 3 SET STATISTICS 500;\E\n 2552 /xms, 2553 like => 2554 { %full_runs, %dump_test_schema_runs, section_post_data => 1, }, 2555 unlike => { exclude_dump_test_schema => 1, }, 2556 }, 2557 2558 'CREATE TABLE test_inheritance_parent' => { 2559 create_order => 90, 2560 create_sql => 'CREATE TABLE dump_test.test_inheritance_parent ( 2561 col1 int NOT NULL, 2562 col2 int CHECK (col2 >= 42) 2563 );', 2564 regexp => qr/^ 2565 \QCREATE TABLE dump_test.test_inheritance_parent (\E\n 2566 \s+\Qcol1 integer NOT NULL,\E\n 2567 \s+\Qcol2 integer,\E\n 2568 \s+\QCONSTRAINT test_inheritance_parent_col2_check CHECK ((col2 >= 42))\E\n 2569 \Q);\E\n 2570 /xm, 2571 like => 2572 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2573 unlike => { exclude_dump_test_schema => 1, }, 2574 }, 2575 2576 'CREATE TABLE test_inheritance_child' => { 2577 create_order => 91, 2578 create_sql => 'CREATE TABLE dump_test.test_inheritance_child ( 2579 col1 int NOT NULL, 2580 CONSTRAINT test_inheritance_child CHECK (col2 >= 142857) 2581 ) INHERITS (dump_test.test_inheritance_parent);', 2582 regexp => qr/^ 2583 \QCREATE TABLE dump_test.test_inheritance_child (\E\n 2584 \s+\Qcol1 integer,\E\n 2585 \s+\QCONSTRAINT test_inheritance_child CHECK ((col2 >= 142857))\E\n 2586 \)\n 2587 \QINHERITS (dump_test.test_inheritance_parent);\E\n 2588 /xm, 2589 like => { 2590 %full_runs, %dump_test_schema_runs, section_pre_data => 1, 2591 }, 2592 unlike => { 2593 binary_upgrade => 1, 2594 exclude_dump_test_schema => 1, 2595 }, 2596 }, 2597 2598 'CREATE STATISTICS extended_stats_no_options' => { 2599 create_order => 97, 2600 create_sql => 'CREATE STATISTICS dump_test.test_ext_stats_no_options 2601 ON col1, col2 FROM dump_test.test_fifth_table', 2602 regexp => qr/^ 2603 \QCREATE STATISTICS dump_test.test_ext_stats_no_options ON col1, col2 FROM dump_test.test_fifth_table;\E 2604 /xms, 2605 like => 2606 { %full_runs, %dump_test_schema_runs, section_post_data => 1, }, 2607 unlike => { exclude_dump_test_schema => 1, }, 2608 }, 2609 2610 'CREATE STATISTICS extended_stats_options' => { 2611 create_order => 97, 2612 create_sql => 'CREATE STATISTICS dump_test.test_ext_stats_opts 2613 (ndistinct) ON col1, col2 FROM dump_test.test_fifth_table', 2614 regexp => qr/^ 2615 \QCREATE STATISTICS dump_test.test_ext_stats_opts (ndistinct) ON col1, col2 FROM dump_test.test_fifth_table;\E 2616 /xms, 2617 like => 2618 { %full_runs, %dump_test_schema_runs, section_post_data => 1, }, 2619 unlike => { exclude_dump_test_schema => 1, }, 2620 }, 2621 2622 'CREATE SEQUENCE test_table_col1_seq' => { 2623 regexp => qr/^ 2624 \QCREATE SEQUENCE dump_test.test_table_col1_seq\E 2625 \n\s+\QAS integer\E 2626 \n\s+\QSTART WITH 1\E 2627 \n\s+\QINCREMENT BY 1\E 2628 \n\s+\QNO MINVALUE\E 2629 \n\s+\QNO MAXVALUE\E 2630 \n\s+\QCACHE 1;\E 2631 /xm, 2632 like => { 2633 %full_runs, 2634 %dump_test_schema_runs, 2635 only_dump_test_table => 1, 2636 section_pre_data => 1, 2637 }, 2638 unlike => { exclude_dump_test_schema => 1, }, 2639 }, 2640 2641 'CREATE SEQUENCE test_third_table_col1_seq' => { 2642 regexp => qr/^ 2643 \QCREATE SEQUENCE dump_test_second_schema.test_third_table_col1_seq\E 2644 \n\s+\QAS integer\E 2645 \n\s+\QSTART WITH 1\E 2646 \n\s+\QINCREMENT BY 1\E 2647 \n\s+\QNO MINVALUE\E 2648 \n\s+\QNO MAXVALUE\E 2649 \n\s+\QCACHE 1;\E 2650 /xm, 2651 like => { 2652 %full_runs, 2653 role => 1, 2654 section_pre_data => 1, 2655 }, 2656 }, 2657 2658 'CREATE UNIQUE INDEX test_third_table_idx ON test_third_table' => { 2659 create_order => 13, 2660 create_sql => 'CREATE UNIQUE INDEX test_third_table_idx 2661 ON dump_test_second_schema.test_third_table (col1);', 2662 regexp => qr/^ 2663 \QCREATE UNIQUE INDEX test_third_table_idx \E 2664 \QON dump_test_second_schema.test_third_table USING btree (col1);\E 2665 /xm, 2666 like => { 2667 %full_runs, 2668 role => 1, 2669 section_post_data => 1, 2670 }, 2671 }, 2672 2673 'CREATE INDEX ON ONLY measurement' => { 2674 create_order => 92, 2675 create_sql => 2676 'CREATE INDEX ON dump_test.measurement (city_id, logdate);', 2677 regexp => qr/^ 2678 \QCREATE INDEX measurement_city_id_logdate_idx ON ONLY dump_test.measurement USING\E 2679 /xm, 2680 like => { 2681 binary_upgrade => 1, 2682 clean => 1, 2683 clean_if_exists => 1, 2684 createdb => 1, 2685 defaults => 1, 2686 exclude_test_table => 1, 2687 exclude_test_table_data => 1, 2688 no_blobs => 1, 2689 no_privs => 1, 2690 no_owner => 1, 2691 only_dump_test_schema => 1, 2692 pg_dumpall_dbprivs => 1, 2693 schema_only => 1, 2694 section_post_data => 1, 2695 test_schema_plus_blobs => 1, 2696 with_oids => 1, 2697 }, 2698 unlike => { 2699 exclude_dump_test_schema => 1, 2700 only_dump_test_table => 1, 2701 pg_dumpall_globals => 1, 2702 pg_dumpall_globals_clean => 1, 2703 role => 1, 2704 section_pre_data => 1, 2705 }, 2706 }, 2707 2708 'ALTER TABLE measurement PRIMARY KEY' => { 2709 all_runs => 1, 2710 catch_all => 'CREATE ... commands', 2711 create_order => 93, 2712 create_sql => 2713 'ALTER TABLE dump_test.measurement ADD PRIMARY KEY (city_id, logdate);', 2714 regexp => qr/^ 2715 \QALTER TABLE ONLY dump_test.measurement\E \n^\s+ 2716 \QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E 2717 /xm, 2718 like => 2719 { %full_runs, %dump_test_schema_runs, section_post_data => 1, }, 2720 unlike => { exclude_dump_test_schema => 1, }, 2721 }, 2722 2723 'CREATE INDEX ... ON measurement_y2006_m2' => { 2724 regexp => qr/^ 2725 \QCREATE INDEX measurement_y2006m2_city_id_logdate_idx ON dump_test_second_schema.measurement_y2006m2 \E 2726 /xm, 2727 like => { 2728 %full_runs, 2729 role => 1, 2730 section_post_data => 1, 2731 }, 2732 }, 2733 2734 'ALTER INDEX ... ATTACH PARTITION' => { 2735 regexp => qr/^ 2736 \QALTER INDEX dump_test.measurement_city_id_logdate_idx ATTACH PARTITION dump_test_second_schema.measurement_y2006m2_city_id_logdate_idx\E 2737 /xm, 2738 like => { 2739 %full_runs, 2740 role => 1, 2741 section_post_data => 1, 2742 }, 2743 }, 2744 2745 'ALTER INDEX ... ATTACH PARTITION (primary key)' => { 2746 all_runs => 1, 2747 catch_all => 'CREATE ... commands', 2748 regexp => qr/^ 2749 \QALTER INDEX dump_test.measurement_pkey ATTACH PARTITION dump_test_second_schema.measurement_y2006m2_pkey\E 2750 /xm, 2751 like => { 2752 binary_upgrade => 1, 2753 clean => 1, 2754 clean_if_exists => 1, 2755 createdb => 1, 2756 defaults => 1, 2757 exclude_dump_test_schema => 1, 2758 exclude_test_table => 1, 2759 exclude_test_table_data => 1, 2760 no_blobs => 1, 2761 no_privs => 1, 2762 no_owner => 1, 2763 pg_dumpall_dbprivs => 1, 2764 role => 1, 2765 schema_only => 1, 2766 section_post_data => 1, 2767 with_oids => 1, 2768 }, 2769 unlike => { 2770 only_dump_test_schema => 1, 2771 only_dump_test_table => 1, 2772 pg_dumpall_globals => 1, 2773 pg_dumpall_globals_clean => 1, 2774 section_pre_data => 1, 2775 test_schema_plus_blobs => 1, 2776 }, 2777 }, 2778 2779 'CREATE VIEW test_view' => { 2780 create_order => 61, 2781 create_sql => 'CREATE VIEW dump_test.test_view 2782 WITH (check_option = \'local\', security_barrier = true) AS 2783 SELECT col1 FROM dump_test.test_table;', 2784 regexp => qr/^ 2785 \QCREATE VIEW dump_test.test_view WITH (security_barrier='true') AS\E 2786 \n\s+\QSELECT test_table.col1\E 2787 \n\s+\QFROM dump_test.test_table\E 2788 \n\s+\QWITH LOCAL CHECK OPTION;\E/xm, 2789 like => 2790 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2791 unlike => { exclude_dump_test_schema => 1, }, 2792 }, 2793 2794 'ALTER VIEW test_view SET DEFAULT' => { 2795 create_order => 62, 2796 create_sql => 2797 'ALTER VIEW dump_test.test_view ALTER COLUMN col1 SET DEFAULT 1;', 2798 regexp => qr/^ 2799 \QALTER TABLE ONLY dump_test.test_view ALTER COLUMN col1 SET DEFAULT 1;\E/xm, 2800 like => 2801 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2802 unlike => { exclude_dump_test_schema => 1, }, 2803 }, 2804 2805 # FIXME 2806 'DROP SCHEMA public (for testing without public schema)' => { 2807 database => 'regress_pg_dump_test', 2808 create_order => 100, 2809 create_sql => 'DROP SCHEMA public;', 2810 regexp => qr/^DROP SCHEMA public;/m, 2811 like => {}, 2812 }, 2813 2814 'DROP SCHEMA public' => { 2815 regexp => qr/^DROP SCHEMA public;/m, 2816 2817 # this shouldn't ever get emitted anymore 2818 like => {}, 2819 }, 2820 2821 'DROP SCHEMA IF EXISTS public' => { 2822 regexp => qr/^DROP SCHEMA IF EXISTS public;/m, 2823 2824 # this shouldn't ever get emitted anymore 2825 like => {}, 2826 }, 2827 2828 'DROP EXTENSION plpgsql' => { 2829 regexp => qr/^DROP EXTENSION plpgsql;/m, 2830 2831 # this shouldn't ever get emitted anymore 2832 like => {}, 2833 }, 2834 2835 'DROP FUNCTION dump_test.pltestlang_call_handler()' => { 2836 regexp => qr/^DROP FUNCTION dump_test\.pltestlang_call_handler\(\);/m, 2837 like => { clean => 1, }, 2838 }, 2839 2840 'DROP LANGUAGE pltestlang' => { 2841 regexp => qr/^DROP PROCEDURAL LANGUAGE pltestlang;/m, 2842 like => { clean => 1, }, 2843 }, 2844 2845 'DROP SCHEMA dump_test' => { 2846 regexp => qr/^DROP SCHEMA dump_test;/m, 2847 like => { clean => 1, }, 2848 }, 2849 2850 'DROP SCHEMA dump_test_second_schema' => { 2851 regexp => qr/^DROP SCHEMA dump_test_second_schema;/m, 2852 like => { clean => 1, }, 2853 }, 2854 2855 'DROP TABLE test_table' => { 2856 regexp => qr/^DROP TABLE dump_test\.test_table;/m, 2857 like => { clean => 1, }, 2858 }, 2859 2860 'DROP TABLE fk_reference_test_table' => { 2861 regexp => qr/^DROP TABLE dump_test\.fk_reference_test_table;/m, 2862 like => { clean => 1, }, 2863 }, 2864 2865 'DROP TABLE test_second_table' => { 2866 regexp => qr/^DROP TABLE dump_test\.test_second_table;/m, 2867 like => { clean => 1, }, 2868 }, 2869 2870 'DROP TABLE test_third_table' => { 2871 regexp => qr/^DROP TABLE dump_test_second_schema\.test_third_table;/m, 2872 like => { clean => 1, }, 2873 }, 2874 2875 'DROP EXTENSION IF EXISTS plpgsql' => { 2876 regexp => qr/^DROP EXTENSION IF EXISTS plpgsql;/m, 2877 2878 # this shouldn't ever get emitted anymore 2879 like => {}, 2880 }, 2881 2882 'DROP FUNCTION IF EXISTS dump_test.pltestlang_call_handler()' => { 2883 regexp => qr/^ 2884 \QDROP FUNCTION IF EXISTS dump_test.pltestlang_call_handler();\E 2885 /xm, 2886 like => { clean_if_exists => 1, }, 2887 }, 2888 2889 'DROP LANGUAGE IF EXISTS pltestlang' => { 2890 regexp => qr/^DROP PROCEDURAL LANGUAGE IF EXISTS pltestlang;/m, 2891 like => { clean_if_exists => 1, }, 2892 }, 2893 2894 'DROP SCHEMA IF EXISTS dump_test' => { 2895 regexp => qr/^DROP SCHEMA IF EXISTS dump_test;/m, 2896 like => { clean_if_exists => 1, }, 2897 }, 2898 2899 'DROP SCHEMA IF EXISTS dump_test_second_schema' => { 2900 regexp => qr/^DROP SCHEMA IF EXISTS dump_test_second_schema;/m, 2901 like => { clean_if_exists => 1, }, 2902 }, 2903 2904 'DROP TABLE IF EXISTS test_table' => { 2905 regexp => qr/^DROP TABLE IF EXISTS dump_test\.test_table;/m, 2906 like => { clean_if_exists => 1, }, 2907 }, 2908 2909 'DROP TABLE IF EXISTS test_second_table' => { 2910 regexp => qr/^DROP TABLE IF EXISTS dump_test\.test_second_table;/m, 2911 like => { clean_if_exists => 1, }, 2912 }, 2913 2914 'DROP TABLE IF EXISTS test_third_table' => { 2915 regexp => qr/^ 2916 \QDROP TABLE IF EXISTS dump_test_second_schema.test_third_table;\E 2917 /xm, 2918 like => { clean_if_exists => 1, }, 2919 }, 2920 2921 'DROP ROLE regress_dump_test_role' => { 2922 regexp => qr/^ 2923 \QDROP ROLE regress_dump_test_role;\E 2924 /xm, 2925 like => { pg_dumpall_globals_clean => 1, }, 2926 }, 2927 2928 'DROP ROLE pg_' => { 2929 regexp => qr/^ 2930 \QDROP ROLE pg_\E.*; 2931 /xm, 2932 2933 # this shouldn't ever get emitted anywhere 2934 like => {}, 2935 }, 2936 2937 'GRANT USAGE ON SCHEMA dump_test_second_schema' => { 2938 create_order => 10, 2939 create_sql => 'GRANT USAGE ON SCHEMA dump_test_second_schema 2940 TO regress_dump_test_role;', 2941 regexp => qr/^ 2942 \QGRANT USAGE ON SCHEMA dump_test_second_schema TO regress_dump_test_role;\E 2943 /xm, 2944 like => { 2945 %full_runs, 2946 role => 1, 2947 section_pre_data => 1, 2948 }, 2949 unlike => { no_privs => 1, }, 2950 }, 2951 2952 'GRANT USAGE ON FOREIGN DATA WRAPPER dummy' => { 2953 create_order => 85, 2954 create_sql => 'GRANT USAGE ON FOREIGN DATA WRAPPER dummy 2955 TO regress_dump_test_role;', 2956 regexp => qr/^ 2957 \QGRANT ALL ON FOREIGN DATA WRAPPER dummy TO regress_dump_test_role;\E 2958 /xm, 2959 like => { %full_runs, section_pre_data => 1, }, 2960 unlike => { no_privs => 1, }, 2961 }, 2962 2963 'GRANT USAGE ON FOREIGN SERVER s1' => { 2964 create_order => 85, 2965 create_sql => 'GRANT USAGE ON FOREIGN SERVER s1 2966 TO regress_dump_test_role;', 2967 regexp => qr/^ 2968 \QGRANT ALL ON FOREIGN SERVER s1 TO regress_dump_test_role;\E 2969 /xm, 2970 like => { %full_runs, section_pre_data => 1, }, 2971 unlike => { no_privs => 1, }, 2972 }, 2973 2974 'GRANT USAGE ON DOMAIN dump_test.us_postal_code' => { 2975 create_order => 72, 2976 create_sql => 2977 'GRANT USAGE ON DOMAIN dump_test.us_postal_code TO regress_dump_test_role;', 2978 regexp => qr/^ 2979 \QGRANT ALL ON TYPE dump_test.us_postal_code TO regress_dump_test_role;\E 2980 /xm, 2981 like => 2982 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2983 unlike => { 2984 exclude_dump_test_schema => 1, 2985 no_privs => 1, 2986 }, 2987 }, 2988 2989 'GRANT USAGE ON TYPE dump_test.int42' => { 2990 create_order => 87, 2991 create_sql => 2992 'GRANT USAGE ON TYPE dump_test.int42 TO regress_dump_test_role;', 2993 regexp => qr/^ 2994 \QGRANT ALL ON TYPE dump_test.int42 TO regress_dump_test_role;\E 2995 /xm, 2996 like => 2997 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 2998 unlike => { 2999 exclude_dump_test_schema => 1, 3000 no_privs => 1, 3001 }, 3002 }, 3003 3004 'GRANT USAGE ON TYPE dump_test.planets - ENUM' => { 3005 create_order => 66, 3006 create_sql => 3007 'GRANT USAGE ON TYPE dump_test.planets TO regress_dump_test_role;', 3008 regexp => qr/^ 3009 \QGRANT ALL ON TYPE dump_test.planets TO regress_dump_test_role;\E 3010 /xm, 3011 like => 3012 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 3013 unlike => { 3014 exclude_dump_test_schema => 1, 3015 no_privs => 1, 3016 }, 3017 }, 3018 3019 'GRANT USAGE ON TYPE dump_test.textrange - RANGE' => { 3020 create_order => 67, 3021 create_sql => 3022 'GRANT USAGE ON TYPE dump_test.textrange TO regress_dump_test_role;', 3023 regexp => qr/^ 3024 \QGRANT ALL ON TYPE dump_test.textrange TO regress_dump_test_role;\E 3025 /xm, 3026 like => 3027 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 3028 unlike => { 3029 exclude_dump_test_schema => 1, 3030 no_privs => 1, 3031 }, 3032 }, 3033 3034 'GRANT CREATE ON DATABASE dump_test' => { 3035 create_order => 48, 3036 create_sql => 3037 'GRANT CREATE ON DATABASE dump_test TO regress_dump_test_role;', 3038 regexp => qr/^ 3039 \QGRANT CREATE ON DATABASE dump_test TO regress_dump_test_role;\E 3040 /xm, 3041 like => { pg_dumpall_dbprivs => 1, }, 3042 }, 3043 3044 'GRANT SELECT ON TABLE test_table' => { 3045 create_order => 5, 3046 create_sql => 'GRANT SELECT ON TABLE dump_test.test_table 3047 TO regress_dump_test_role;', 3048 regexp => 3049 qr/^GRANT SELECT ON TABLE dump_test.test_table TO regress_dump_test_role;/m, 3050 like => { 3051 %full_runs, 3052 %dump_test_schema_runs, 3053 only_dump_test_table => 1, 3054 section_pre_data => 1, 3055 }, 3056 unlike => { 3057 exclude_dump_test_schema => 1, 3058 exclude_test_table => 1, 3059 no_privs => 1, 3060 }, 3061 }, 3062 3063 'GRANT SELECT ON TABLE test_third_table' => { 3064 create_order => 19, 3065 create_sql => 'GRANT SELECT ON 3066 TABLE dump_test_second_schema.test_third_table 3067 TO regress_dump_test_role;', 3068 regexp => 3069 qr/^GRANT SELECT ON TABLE dump_test_second_schema.test_third_table TO regress_dump_test_role;/m, 3070 like => { 3071 %full_runs, 3072 role => 1, 3073 section_pre_data => 1, 3074 }, 3075 unlike => { no_privs => 1, }, 3076 }, 3077 3078 'GRANT ALL ON SEQUENCE test_third_table_col1_seq' => { 3079 create_order => 28, 3080 create_sql => 'GRANT ALL ON SEQUENCE 3081 dump_test_second_schema.test_third_table_col1_seq 3082 TO regress_dump_test_role;', 3083 regexp => qr/^ 3084 \QGRANT ALL ON SEQUENCE dump_test_second_schema.test_third_table_col1_seq TO regress_dump_test_role;\E 3085 /xm, 3086 like => { 3087 %full_runs, 3088 role => 1, 3089 section_pre_data => 1, 3090 }, 3091 unlike => { no_privs => 1, }, 3092 }, 3093 3094 'GRANT SELECT ON TABLE measurement' => { 3095 create_order => 91, 3096 create_sql => 'GRANT SELECT ON 3097 TABLE dump_test.measurement 3098 TO regress_dump_test_role;', 3099 regexp => 3100 qr/^GRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;/m, 3101 like => 3102 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 3103 unlike => { 3104 exclude_dump_test_schema => 1, 3105 no_privs => 1, 3106 }, 3107 }, 3108 3109 'GRANT SELECT ON TABLE measurement_y2006m2' => { 3110 create_order => 94, 3111 create_sql => 'GRANT SELECT ON TABLE 3112 dump_test_second_schema.measurement_y2006m2, 3113 dump_test_second_schema.measurement_y2006m3, 3114 dump_test_second_schema.measurement_y2006m4, 3115 dump_test_second_schema.measurement_y2006m5 3116 TO regress_dump_test_role;', 3117 regexp => 3118 qr/^GRANT SELECT ON TABLE dump_test_second_schema.measurement_y2006m2 TO regress_dump_test_role;/m, 3119 like => { 3120 %full_runs, 3121 role => 1, 3122 section_pre_data => 1, 3123 }, 3124 unlike => { no_privs => 1, }, 3125 }, 3126 3127 'GRANT ALL ON LARGE OBJECT ...' => { 3128 create_order => 60, 3129 create_sql => 'DO $$ 3130 DECLARE myoid oid; 3131 BEGIN 3132 SELECT loid FROM pg_largeobject INTO myoid; 3133 EXECUTE \'GRANT ALL ON LARGE OBJECT \' || myoid || \' TO regress_dump_test_role;\'; 3134 END; 3135 $$;', 3136 regexp => qr/^ 3137 \QGRANT ALL ON LARGE OBJECT \E[0-9]+\Q TO regress_dump_test_role;\E 3138 /xm, 3139 like => { 3140 %full_runs, 3141 column_inserts => 1, 3142 data_only => 1, 3143 section_pre_data => 1, 3144 test_schema_plus_blobs => 1, 3145 }, 3146 unlike => { 3147 binary_upgrade => 1, 3148 no_blobs => 1, 3149 no_privs => 1, 3150 schema_only => 1, 3151 }, 3152 }, 3153 3154 'GRANT INSERT(col1) ON TABLE test_second_table' => { 3155 create_order => 8, 3156 create_sql => 3157 'GRANT INSERT (col1) ON TABLE dump_test.test_second_table 3158 TO regress_dump_test_role;', 3159 regexp => qr/^ 3160 \QGRANT INSERT(col1) ON TABLE dump_test.test_second_table TO regress_dump_test_role;\E 3161 /xm, 3162 like => 3163 { %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, 3164 unlike => { 3165 exclude_dump_test_schema => 1, 3166 no_privs => 1, 3167 }, 3168 }, 3169 3170 'GRANT EXECUTE ON FUNCTION pg_sleep() TO regress_dump_test_role' => { 3171 create_order => 16, 3172 create_sql => 'GRANT EXECUTE ON FUNCTION pg_sleep(float8) 3173 TO regress_dump_test_role;', 3174 regexp => qr/^ 3175 \QGRANT ALL ON FUNCTION pg_catalog.pg_sleep(double precision) TO regress_dump_test_role;\E 3176 /xm, 3177 like => { %full_runs, section_pre_data => 1, }, 3178 unlike => { no_privs => 1, }, 3179 }, 3180 3181 'GRANT SELECT (proname ...) ON TABLE pg_proc TO public' => { 3182 create_order => 46, 3183 create_sql => 'GRANT SELECT ( 3184 tableoid, 3185 oid, 3186 proname, 3187 pronamespace, 3188 proowner, 3189 prolang, 3190 procost, 3191 prorows, 3192 provariadic, 3193 protransform, 3194 prokind, 3195 prosecdef, 3196 proleakproof, 3197 proisstrict, 3198 proretset, 3199 provolatile, 3200 proparallel, 3201 pronargs, 3202 pronargdefaults, 3203 prorettype, 3204 proargtypes, 3205 proallargtypes, 3206 proargmodes, 3207 proargnames, 3208 proargdefaults, 3209 protrftypes, 3210 prosrc, 3211 probin, 3212 proconfig, 3213 proacl 3214 ) ON TABLE pg_proc TO public;', 3215 regexp => qr/ 3216 \QGRANT SELECT(tableoid) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3217 \QGRANT SELECT(oid) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3218 \QGRANT SELECT(proname) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3219 \QGRANT SELECT(pronamespace) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3220 \QGRANT SELECT(proowner) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3221 \QGRANT SELECT(prolang) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3222 \QGRANT SELECT(procost) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3223 \QGRANT SELECT(prorows) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3224 \QGRANT SELECT(provariadic) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3225 \QGRANT SELECT(protransform) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3226 \QGRANT SELECT(prokind) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3227 \QGRANT SELECT(prosecdef) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3228 \QGRANT SELECT(proleakproof) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3229 \QGRANT SELECT(proisstrict) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3230 \QGRANT SELECT(proretset) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3231 \QGRANT SELECT(provolatile) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3232 \QGRANT SELECT(proparallel) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3233 \QGRANT SELECT(pronargs) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3234 \QGRANT SELECT(pronargdefaults) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3235 \QGRANT SELECT(prorettype) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3236 \QGRANT SELECT(proargtypes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3237 \QGRANT SELECT(proallargtypes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3238 \QGRANT SELECT(proargmodes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3239 \QGRANT SELECT(proargnames) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3240 \QGRANT SELECT(proargdefaults) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3241 \QGRANT SELECT(protrftypes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3242 \QGRANT SELECT(prosrc) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3243 \QGRANT SELECT(probin) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3244 \QGRANT SELECT(proconfig) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* 3245 \QGRANT SELECT(proacl) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E/xms, 3246 like => { %full_runs, section_pre_data => 1, }, 3247 unlike => { no_privs => 1, }, 3248 }, 3249 3250 'GRANT USAGE ON SCHEMA public TO public' => { 3251 regexp => qr/^ 3252 \Q--\E\n\n 3253 \QGRANT USAGE ON SCHEMA public TO PUBLIC;\E 3254 /xm, 3255 3256 # this shouldn't ever get emitted anymore 3257 like => {}, 3258 }, 3259 3260 'REFRESH MATERIALIZED VIEW matview' => { 3261 regexp => qr/^REFRESH MATERIALIZED VIEW dump_test.matview;/m, 3262 like => 3263 { %full_runs, %dump_test_schema_runs, section_post_data => 1, }, 3264 unlike => { 3265 binary_upgrade => 1, 3266 exclude_dump_test_schema => 1, 3267 schema_only => 1, 3268 }, 3269 }, 3270 3271 'REFRESH MATERIALIZED VIEW matview_second' => { 3272 regexp => qr/^ 3273 \QREFRESH MATERIALIZED VIEW dump_test.matview;\E 3274 \n.* 3275 \QREFRESH MATERIALIZED VIEW dump_test.matview_second;\E 3276 /xms, 3277 like => 3278 { %full_runs, %dump_test_schema_runs, section_post_data => 1, }, 3279 unlike => { 3280 binary_upgrade => 1, 3281 exclude_dump_test_schema => 1, 3282 schema_only => 1, 3283 }, 3284 }, 3285 3286 # FIXME 3287 'REFRESH MATERIALIZED VIEW matview_third' => { 3288 regexp => qr/^ 3289 \QREFRESH MATERIALIZED VIEW dump_test.matview_third;\E 3290 /xms, 3291 like => {}, 3292 }, 3293 3294 # FIXME 3295 'REFRESH MATERIALIZED VIEW matview_fourth' => { 3296 regexp => qr/^ 3297 \QREFRESH MATERIALIZED VIEW dump_test.matview_fourth;\E 3298 /xms, 3299 like => {}, 3300 }, 3301 3302 'REVOKE CONNECT ON DATABASE dump_test FROM public' => { 3303 create_order => 49, 3304 create_sql => 'REVOKE CONNECT ON DATABASE dump_test FROM public;', 3305 regexp => qr/^ 3306 \QREVOKE CONNECT,TEMPORARY ON DATABASE dump_test FROM PUBLIC;\E\n 3307 \QGRANT TEMPORARY ON DATABASE dump_test TO PUBLIC;\E\n 3308 \QGRANT CREATE ON DATABASE dump_test TO regress_dump_test_role;\E 3309 /xm, 3310 like => { pg_dumpall_dbprivs => 1, }, 3311 }, 3312 3313 'REVOKE EXECUTE ON FUNCTION pg_sleep() FROM public' => { 3314 create_order => 15, 3315 create_sql => 'REVOKE EXECUTE ON FUNCTION pg_sleep(float8) 3316 FROM public;', 3317 regexp => qr/^ 3318 \QREVOKE ALL ON FUNCTION pg_catalog.pg_sleep(double precision) FROM PUBLIC;\E 3319 /xm, 3320 like => { %full_runs, section_pre_data => 1, }, 3321 unlike => { no_privs => 1, }, 3322 }, 3323 3324 'REVOKE SELECT ON TABLE pg_proc FROM public' => { 3325 create_order => 45, 3326 create_sql => 'REVOKE SELECT ON TABLE pg_proc FROM public;', 3327 regexp => 3328 qr/^REVOKE SELECT ON TABLE pg_catalog.pg_proc FROM PUBLIC;/m, 3329 like => { %full_runs, section_pre_data => 1, }, 3330 unlike => { no_privs => 1, }, 3331 }, 3332 3333 'REVOKE CREATE ON SCHEMA public FROM public' => { 3334 create_order => 16, 3335 create_sql => 'REVOKE CREATE ON SCHEMA public FROM public;', 3336 regexp => qr/^ 3337 \QREVOKE ALL ON SCHEMA public FROM PUBLIC;\E 3338 \n\QGRANT USAGE ON SCHEMA public TO PUBLIC;\E 3339 /xm, 3340 like => { %full_runs, section_pre_data => 1, }, 3341 unlike => { no_privs => 1, }, 3342 }, 3343 3344 'REVOKE USAGE ON LANGUAGE plpgsql FROM public' => { 3345 create_order => 16, 3346 create_sql => 'REVOKE USAGE ON LANGUAGE plpgsql FROM public;', 3347 regexp => qr/^REVOKE ALL ON LANGUAGE plpgsql FROM PUBLIC;/m, 3348 like => { 3349 %full_runs, 3350 %dump_test_schema_runs, 3351 only_dump_test_table => 1, 3352 role => 1, 3353 section_pre_data => 1, 3354 }, 3355 unlike => { no_privs => 1, }, 3356 }, 3357 3358); 3359 3360######################################### 3361# Create a PG instance to test actually dumping from 3362 3363my $node = get_new_node('main'); 3364$node->init; 3365$node->start; 3366 3367my $port = $node->port; 3368 3369# We need to see if this system supports CREATE COLLATION or not 3370# If it doesn't then we will skip all the COLLATION-related tests. 3371my $collation_support = 0; 3372my $collation_check_stderr; 3373$node->psql( 3374 'postgres', 3375 "CREATE COLLATION testing FROM \"C\"; DROP COLLATION testing;", 3376 on_error_stop => 0, 3377 stderr => \$collation_check_stderr); 3378 3379if ($collation_check_stderr !~ /ERROR: /) 3380{ 3381 $collation_support = 1; 3382} 3383 3384# Create a second database for certain tests to work against 3385$node->psql('postgres', 'create database regress_pg_dump_test;'); 3386 3387# Start with number of command_fails_like()*2 tests below (each 3388# command_fails_like is actually 2 tests) 3389my $num_tests = 12; 3390 3391foreach my $run (sort keys %pgdump_runs) 3392{ 3393 my $test_key = $run; 3394 my $run_db = 'postgres'; 3395 3396 if (defined($pgdump_runs{$run}->{database})) 3397 { 3398 $run_db = $pgdump_runs{$run}->{database}; 3399 } 3400 3401 # Each run of pg_dump is a test itself 3402 $num_tests++; 3403 3404 # If there is a restore cmd, that's another test 3405 if ($pgdump_runs{$run}->{restore_cmd}) 3406 { 3407 $num_tests++; 3408 } 3409 3410 if ($pgdump_runs{$run}->{test_key}) 3411 { 3412 $test_key = $pgdump_runs{$run}->{test_key}; 3413 } 3414 3415 # Then count all the tests run against each run 3416 foreach my $test (sort keys %tests) 3417 { 3418 3419 # postgres is the default database, if it isn't overridden 3420 my $test_db = 'postgres'; 3421 3422 # Specific tests can override the database to use 3423 if (defined($tests{$test}->{database})) 3424 { 3425 $test_db = $tests{$test}->{database}; 3426 } 3427 3428 # The database to test against needs to match the database the run is 3429 # for, so skip combinations where they don't match up. 3430 if ($run_db ne $test_db) 3431 { 3432 next; 3433 } 3434 3435 # Skip any collation-related commands if there is no collation support 3436 if (!$collation_support && defined($tests{$test}->{collation})) 3437 { 3438 next; 3439 } 3440 3441 # If there is a like entry, but no unlike entry, then we will test the like case 3442 if ($tests{$test}->{like}->{$test_key} 3443 && !defined($tests{$test}->{unlike}->{$test_key})) 3444 { 3445 $num_tests++; 3446 } 3447 else 3448 { 3449 # We will test everything that isn't a 'like' 3450 $num_tests++; 3451 } 3452 } 3453} 3454plan tests => $num_tests; 3455 3456######################################### 3457# Set up schemas, tables, etc, to be dumped. 3458 3459# Build up the create statements 3460my %create_sql = (); 3461 3462foreach my $test ( 3463 sort { 3464 if ($tests{$a}->{create_order} and $tests{$b}->{create_order}) 3465 { 3466 $tests{$a}->{create_order} <=> $tests{$b}->{create_order}; 3467 } 3468 elsif ($tests{$a}->{create_order}) 3469 { 3470 -1; 3471 } 3472 elsif ($tests{$b}->{create_order}) 3473 { 3474 1; 3475 } 3476 else 3477 { 3478 0; 3479 } 3480 } keys %tests) 3481{ 3482 my $test_db = 'postgres'; 3483 3484 if (defined($tests{$test}->{database})) 3485 { 3486 $test_db = $tests{$test}->{database}; 3487 } 3488 3489 if ($tests{$test}->{create_sql}) 3490 { 3491 3492 # Skip any collation-related commands if there is no collation support 3493 if (!$collation_support && defined($tests{$test}->{collation})) 3494 { 3495 next; 3496 } 3497 3498 # Add terminating semicolon 3499 $create_sql{$test_db} .= $tests{$test}->{create_sql} . ";"; 3500 } 3501} 3502 3503# Send the combined set of commands to psql 3504foreach my $db (sort keys %create_sql) 3505{ 3506 $node->safe_psql($db, $create_sql{$db}); 3507} 3508 3509######################################### 3510# Test connecting to a non-existent database 3511 3512command_fails_like( 3513 [ 'pg_dump', '-p', "$port", 'qqq' ], 3514 qr/\Qpg_dump: [archiver (db)] connection to database "qqq" failed: FATAL: database "qqq" does not exist\E/, 3515 'pg_dump: [archiver (db)] connection to database "qqq" failed: FATAL: database "qqq" does not exist' 3516); 3517 3518######################################### 3519# Test connecting with an unprivileged user 3520 3521command_fails_like( 3522 [ 'pg_dump', '-p', "$port", '--role=regress_dump_test_role' ], 3523 qr/\Qpg_dump: [archiver (db)] query failed: ERROR: permission denied for\E/, 3524 'pg_dump: [archiver (db)] query failed: ERROR: permission denied for'); 3525 3526######################################### 3527# Test dumping a non-existent schema, table, and patterns with --strict-names 3528 3529command_fails_like( 3530 [ 'pg_dump', '-p', "$port", '-n', 'nonexistant' ], 3531 qr/\Qpg_dump: no matching schemas were found\E/, 3532 'pg_dump: no matching schemas were found'); 3533 3534command_fails_like( 3535 [ 'pg_dump', '-p', "$port", '-t', 'nonexistant' ], 3536 qr/\Qpg_dump: no matching tables were found\E/, 3537 'pg_dump: no matching tables were found'); 3538 3539command_fails_like( 3540 [ 'pg_dump', '-p', "$port", '--strict-names', '-n', 'nonexistant*' ], 3541 qr/\Qpg_dump: no matching schemas were found for pattern\E/, 3542 'pg_dump: no matching schemas were found for pattern'); 3543 3544command_fails_like( 3545 [ 'pg_dump', '-p', "$port", '--strict-names', '-t', 'nonexistant*' ], 3546 qr/\Qpg_dump: no matching tables were found for pattern\E/, 3547 'pg_dump: no matching tables were found for pattern'); 3548 3549######################################### 3550# Run all runs 3551 3552foreach my $run (sort keys %pgdump_runs) 3553{ 3554 my $test_key = $run; 3555 my $run_db = 'postgres'; 3556 3557 $node->command_ok(\@{ $pgdump_runs{$run}->{dump_cmd} }, 3558 "$run: pg_dump runs"); 3559 3560 if ($pgdump_runs{$run}->{restore_cmd}) 3561 { 3562 $node->command_ok(\@{ $pgdump_runs{$run}->{restore_cmd} }, 3563 "$run: pg_restore runs"); 3564 } 3565 3566 if ($pgdump_runs{$run}->{test_key}) 3567 { 3568 $test_key = $pgdump_runs{$run}->{test_key}; 3569 } 3570 3571 my $output_file = slurp_file("$tempdir/${run}.sql"); 3572 3573 ######################################### 3574 # Run all tests where this run is included 3575 # as either a 'like' or 'unlike' test. 3576 3577 foreach my $test (sort keys %tests) 3578 { 3579 my $test_db = 'postgres'; 3580 3581 if (defined($pgdump_runs{$run}->{database})) 3582 { 3583 $run_db = $pgdump_runs{$run}->{database}; 3584 } 3585 3586 if (defined($tests{$test}->{database})) 3587 { 3588 $test_db = $tests{$test}->{database}; 3589 } 3590 3591 # Skip any collation-related commands if there is no collation support 3592 if (!$collation_support && defined($tests{$test}->{collation})) 3593 { 3594 next; 3595 } 3596 3597 if ($run_db ne $test_db) 3598 { 3599 next; 3600 } 3601 3602 # Run the test listed as a like, unless it is specifically noted 3603 # as an unlike (generally due to an explicit exclusion or similar). 3604 if ($tests{$test}->{like}->{$test_key} 3605 && !defined($tests{$test}->{unlike}->{$test_key})) 3606 { 3607 if (!ok($output_file =~ $tests{$test}->{regexp}, 3608 "$run: should dump $test")) 3609 { 3610 diag("Review $run results in $tempdir"); 3611 } 3612 } 3613 else 3614 { 3615 if (!ok($output_file !~ $tests{$test}->{regexp}, 3616 "$run: should not dump $test")) 3617 { 3618 diag("Review $run results in $tempdir"); 3619 } 3620 } 3621 } 3622} 3623 3624######################################### 3625# Stop the database instance, which will be removed at the end of the tests. 3626 3627$node->stop('fast'); 3628