| 1 |
|
| 2 |
# Copyright (c) 2021-2025, PostgreSQL Global Development Group |
| 3 |
|
| 4 |
use strict; |
| 5 |
use warnings FATAL => 'all'; |
| 6 |
|
| 7 |
use PostgreSQL::Test::Cluster; |
| 8 |
use PostgreSQL::Test::Utils; |
| 9 |
use Test::More; |
| 10 |
|
| 11 |
my $tempdir = PostgreSQL::Test::Utils::tempdir; |
| 12 |
|
| 13 |
############################################################### |
| 14 |
# Definition of the pg_dump runs to make. |
| 15 |
# |
| 16 |
# Each of these runs are named and those names are used below |
| 17 |
# to define how each test should (or shouldn't) treat a result |
| 18 |
# from a given run. |
| 19 |
# |
| 20 |
# test_key indicates that a given run should simply use the same |
| 21 |
# set of like/unlike tests as another run, and which run that is. |
| 22 |
# |
| 23 |
# compile_option indicates if the commands run depend on a compilation |
| 24 |
# option, if any. This can be used to control if tests should be |
| 25 |
# skipped when a build dependency is not satisfied. |
| 26 |
# |
| 27 |
# dump_cmd is the pg_dump command to run, which is an array of |
| 28 |
# the full command and arguments to run. Note that this is run |
| 29 |
# using $node->command_ok(), so the port does not need to be |
| 30 |
# specified and is pulled from $PGPORT, which is set by the |
| 31 |
# PostgreSQL::Test::Cluster system. |
| 32 |
# |
| 33 |
# compress_cmd is the utility command for (de)compression, if any. |
| 34 |
# Note that this should generally be used on pg_dump's output |
| 35 |
# either to generate a text file to run the through the tests, or |
| 36 |
# to test pg_restore's ability to parse manually compressed files |
| 37 |
# that otherwise pg_dump does not compress on its own (e.g. *.toc). |
| 38 |
# |
| 39 |
# glob_patterns is an optional array consisting of strings compilable |
| 40 |
# with glob() to check the files generated after a dump. |
| 41 |
# |
| 42 |
# command_like is an optional utility that can be used to compare |
| 43 |
# the output generated by a command on the contents of an existing |
| 44 |
# dump, like the TOC description of a pg_restore command. |
| 45 |
# |
| 46 |
# restore_cmd is the pg_restore command to run, if any. Note |
| 47 |
# that this should generally be used when the pg_dump goes to |
| 48 |
# a non-text file and that the restore can then be used to |
| 49 |
# generate a text file to run through the tests from the |
| 50 |
# non-text file generated by pg_dump. |
| 51 |
# |
| 52 |
# TODO: Have pg_restore actually restore to an independent |
| 53 |
# database and then pg_dump *that* database (or something along |
| 54 |
# those lines) to validate that part of the process. |
| 55 |
|
| 56 |
my $supports_icu = ($ENV{with_icu} eq 'yes'); |
| 57 |
my $supports_gzip = check_pg_config("#define HAVE_LIBZ 1"); |
| 58 |
my $supports_lz4 = check_pg_config("#define USE_LZ4 1"); |
| 59 |
my $supports_zstd = check_pg_config("#define USE_ZSTD 1"); |
| 60 |
|
| 61 |
my %pgdump_runs = ( |
| 62 |
binary_upgrade => { |
| 63 |
dump_cmd => [ |
| 64 |
'pg_dump', '--no-sync', |
| 65 |
'--format' => 'custom', |
| 66 |
'--file' => "$tempdir/binary_upgrade.dump", |
| 67 |
'--no-password', |
| 68 |
'--no-data', |
| 69 |
'--sequence-data', |
| 70 |
'--binary-upgrade', |
| 71 |
'--statistics', |
| 72 |
'--dbname' => 'postgres', # alternative way to specify database |
| 73 |
], |
| 74 |
restore_cmd => [ |
| 75 |
'pg_restore', |
| 76 |
'--format' => 'custom', |
| 77 |
'--verbose', |
| 78 |
'--file' => "$tempdir/binary_upgrade.sql", |
| 79 |
'--statistics', |
| 80 |
"$tempdir/binary_upgrade.dump", |
| 81 |
], |
| 82 |
}, |
| 83 |
|
| 84 |
# Do not use --no-sync to give test coverage for data sync. |
| 85 |
compression_gzip_custom => { |
| 86 |
test_key => 'compression', |
| 87 |
compile_option => 'gzip', |
| 88 |
dump_cmd => [ |
| 89 |
'pg_dump', |
| 90 |
'--format' => 'custom', |
| 91 |
'--compress' => '1', |
| 92 |
'--file' => "$tempdir/compression_gzip_custom.dump", |
| 93 |
'--statistics', |
| 94 |
'postgres', |
| 95 |
], |
| 96 |
restore_cmd => [ |
| 97 |
'pg_restore', |
| 98 |
'--file' => "$tempdir/compression_gzip_custom.sql", |
| 99 |
'--statistics', |
| 100 |
"$tempdir/compression_gzip_custom.dump", |
| 101 |
], |
| 102 |
command_like => { |
| 103 |
command => [ |
| 104 |
'pg_restore', '--list', |
| 105 |
"$tempdir/compression_gzip_custom.dump", |
| 106 |
], |
| 107 |
expected => qr/Compression: gzip/, |
| 108 |
name => 'data content is gzip-compressed' |
| 109 |
}, |
| 110 |
}, |
| 111 |
|
| 112 |
# Do not use --no-sync to give test coverage for data sync. |
| 113 |
compression_gzip_dir => { |
| 114 |
test_key => 'compression', |
| 115 |
compile_option => 'gzip', |
| 116 |
dump_cmd => [ |
| 117 |
'pg_dump', |
| 118 |
'--jobs' => '2', |
| 119 |
'--format' => 'directory', |
| 120 |
'--compress' => 'gzip:1', |
| 121 |
'--file' => "$tempdir/compression_gzip_dir", |
| 122 |
'--statistics', |
| 123 |
'postgres', |
| 124 |
], |
| 125 |
# Give coverage for manually compressed blobs.toc files during |
| 126 |
# restore. |
| 127 |
compress_cmd => { |
| 128 |
program => $ENV{'GZIP_PROGRAM'}, |
| 129 |
args => [ '-f', "$tempdir/compression_gzip_dir/blobs_*.toc", ], |
| 130 |
}, |
| 131 |
# Verify that only data files were compressed |
| 132 |
glob_patterns => [ |
| 133 |
"$tempdir/compression_gzip_dir/toc.dat", |
| 134 |
"$tempdir/compression_gzip_dir/*.dat.gz", |
| 135 |
], |
| 136 |
restore_cmd => [ |
| 137 |
'pg_restore', |
| 138 |
'--jobs' => '2', |
| 139 |
'--file' => "$tempdir/compression_gzip_dir.sql", |
| 140 |
'--statistics', |
| 141 |
"$tempdir/compression_gzip_dir", |
| 142 |
], |
| 143 |
}, |
| 144 |
|
| 145 |
compression_gzip_plain => { |
| 146 |
test_key => 'compression', |
| 147 |
compile_option => 'gzip', |
| 148 |
dump_cmd => [ |
| 149 |
'pg_dump', |
| 150 |
'--format' => 'plain', |
| 151 |
'--compress' => '1', |
| 152 |
'--file' => "$tempdir/compression_gzip_plain.sql.gz", |
| 153 |
'--statistics', |
| 154 |
'postgres', |
| 155 |
], |
| 156 |
# Decompress the generated file to run through the tests. |
| 157 |
compress_cmd => { |
| 158 |
program => $ENV{'GZIP_PROGRAM'}, |
| 159 |
args => [ '-d', "$tempdir/compression_gzip_plain.sql.gz", ], |
| 160 |
}, |
| 161 |
}, |
| 162 |
|
| 163 |
# Do not use --no-sync to give test coverage for data sync. |
| 164 |
compression_lz4_custom => { |
| 165 |
test_key => 'compression', |
| 166 |
compile_option => 'lz4', |
| 167 |
dump_cmd => [ |
| 168 |
'pg_dump', |
| 169 |
'--format' => 'custom', |
| 170 |
'--compress' => 'lz4', |
| 171 |
'--file' => "$tempdir/compression_lz4_custom.dump", |
| 172 |
'--statistics', |
| 173 |
'postgres', |
| 174 |
], |
| 175 |
restore_cmd => [ |
| 176 |
'pg_restore', |
| 177 |
'--file' => "$tempdir/compression_lz4_custom.sql", |
| 178 |
'--statistics', |
| 179 |
"$tempdir/compression_lz4_custom.dump", |
| 180 |
], |
| 181 |
command_like => { |
| 182 |
command => [ |
| 183 |
'pg_restore', '--list', |
| 184 |
"$tempdir/compression_lz4_custom.dump", |
| 185 |
], |
| 186 |
expected => qr/Compression: lz4/, |
| 187 |
name => 'data content is lz4 compressed' |
| 188 |
}, |
| 189 |
}, |
| 190 |
|
| 191 |
# Do not use --no-sync to give test coverage for data sync. |
| 192 |
compression_lz4_dir => { |
| 193 |
test_key => 'compression', |
| 194 |
compile_option => 'lz4', |
| 195 |
dump_cmd => [ |
| 196 |
'pg_dump', |
| 197 |
'--jobs' => '2', |
| 198 |
'--format' => 'directory', |
| 199 |
'--compress' => 'lz4:1', |
| 200 |
'--file' => "$tempdir/compression_lz4_dir", |
| 201 |
'--statistics', |
| 202 |
'postgres', |
| 203 |
], |
| 204 |
# Give coverage for manually compressed blobs.toc files during |
| 205 |
# restore. |
| 206 |
compress_cmd => { |
| 207 |
program => $ENV{'LZ4'}, |
| 208 |
args => [ |
| 209 |
'-z', '-f', '-m', '--rm', |
| 210 |
"$tempdir/compression_lz4_dir/blobs_*.toc", |
| 211 |
], |
| 212 |
}, |
| 213 |
# Verify that data files were compressed |
| 214 |
glob_patterns => [ |
| 215 |
"$tempdir/compression_lz4_dir/toc.dat", |
| 216 |
"$tempdir/compression_lz4_dir/*.dat.lz4", |
| 217 |
], |
| 218 |
restore_cmd => [ |
| 219 |
'pg_restore', |
| 220 |
'--jobs' => '2', |
| 221 |
'--file' => "$tempdir/compression_lz4_dir.sql", |
| 222 |
'--statistics', |
| 223 |
"$tempdir/compression_lz4_dir", |
| 224 |
], |
| 225 |
}, |
| 226 |
|
| 227 |
compression_lz4_plain => { |
| 228 |
test_key => 'compression', |
| 229 |
compile_option => 'lz4', |
| 230 |
dump_cmd => [ |
| 231 |
'pg_dump', |
| 232 |
'--format' => 'plain', |
| 233 |
'--compress' => 'lz4', |
| 234 |
'--file' => "$tempdir/compression_lz4_plain.sql.lz4", |
| 235 |
'--statistics', |
| 236 |
'postgres', |
| 237 |
], |
| 238 |
# Decompress the generated file to run through the tests. |
| 239 |
compress_cmd => { |
| 240 |
program => $ENV{'LZ4'}, |
| 241 |
args => [ |
| 242 |
'-d', '-f', |
| 243 |
"$tempdir/compression_lz4_plain.sql.lz4", |
| 244 |
"$tempdir/compression_lz4_plain.sql", |
| 245 |
], |
| 246 |
}, |
| 247 |
}, |
| 248 |
|
| 249 |
compression_zstd_custom => { |
| 250 |
test_key => 'compression', |
| 251 |
compile_option => 'zstd', |
| 252 |
dump_cmd => [ |
| 253 |
'pg_dump', |
| 254 |
'--format' => 'custom', |
| 255 |
'--compress' => 'zstd', |
| 256 |
'--file' => "$tempdir/compression_zstd_custom.dump", |
| 257 |
'--statistics', |
| 258 |
'postgres', |
| 259 |
], |
| 260 |
restore_cmd => [ |
| 261 |
'pg_restore', |
| 262 |
'--file' => "$tempdir/compression_zstd_custom.sql", |
| 263 |
'--statistics', |
| 264 |
"$tempdir/compression_zstd_custom.dump", |
| 265 |
], |
| 266 |
command_like => { |
| 267 |
command => [ |
| 268 |
'pg_restore', '--list', |
| 269 |
"$tempdir/compression_zstd_custom.dump", |
| 270 |
], |
| 271 |
expected => qr/Compression: zstd/, |
| 272 |
name => 'data content is zstd compressed' |
| 273 |
}, |
| 274 |
}, |
| 275 |
|
| 276 |
compression_zstd_dir => { |
| 277 |
test_key => 'compression', |
| 278 |
compile_option => 'zstd', |
| 279 |
dump_cmd => [ |
| 280 |
'pg_dump', |
| 281 |
'--jobs' => '2', |
| 282 |
'--format' => 'directory', |
| 283 |
'--compress' => 'zstd:1', |
| 284 |
'--file' => "$tempdir/compression_zstd_dir", |
| 285 |
'--statistics', |
| 286 |
'postgres', |
| 287 |
], |
| 288 |
# Give coverage for manually compressed blobs.toc files during |
| 289 |
# restore. |
| 290 |
compress_cmd => { |
| 291 |
program => $ENV{'ZSTD'}, |
| 292 |
args => [ |
| 293 |
'-z', '-f', |
| 294 |
'--rm', "$tempdir/compression_zstd_dir/blobs_*.toc", |
| 295 |
], |
| 296 |
}, |
| 297 |
# Verify that data files were compressed |
| 298 |
glob_patterns => [ |
| 299 |
"$tempdir/compression_zstd_dir/toc.dat", |
| 300 |
"$tempdir/compression_zstd_dir/*.dat.zst", |
| 301 |
], |
| 302 |
restore_cmd => [ |
| 303 |
'pg_restore', |
| 304 |
'--jobs' => '2', |
| 305 |
'--file' => "$tempdir/compression_zstd_dir.sql", |
| 306 |
'--statistics', |
| 307 |
"$tempdir/compression_zstd_dir", |
| 308 |
], |
| 309 |
}, |
| 310 |
|
| 311 |
# Exercise long mode for test coverage |
| 312 |
compression_zstd_plain => { |
| 313 |
test_key => 'compression', |
| 314 |
compile_option => 'zstd', |
| 315 |
dump_cmd => [ |
| 316 |
'pg_dump', |
| 317 |
'--format' => 'plain', |
| 318 |
'--compress' => 'zstd:long', |
| 319 |
'--file' => "$tempdir/compression_zstd_plain.sql.zst", |
| 320 |
'--statistics', |
| 321 |
'postgres', |
| 322 |
], |
| 323 |
# Decompress the generated file to run through the tests. |
| 324 |
compress_cmd => { |
| 325 |
program => $ENV{'ZSTD'}, |
| 326 |
args => [ |
| 327 |
'-d', '-f', |
| 328 |
"$tempdir/compression_zstd_plain.sql.zst", "-o", |
| 329 |
"$tempdir/compression_zstd_plain.sql", |
| 330 |
], |
| 331 |
}, |
| 332 |
}, |
| 333 |
|
| 334 |
clean => { |
| 335 |
dump_cmd => [ |
| 336 |
'pg_dump', '--no-sync', |
| 337 |
'--file' => "$tempdir/clean.sql", |
| 338 |
'--clean', |
| 339 |
'--statistics', |
| 340 |
'--dbname' => 'postgres', # alternative way to specify database |
| 341 |
], |
| 342 |
}, |
| 343 |
clean_if_exists => { |
| 344 |
dump_cmd => [ |
| 345 |
'pg_dump', '--no-sync', |
| 346 |
'--file' => "$tempdir/clean_if_exists.sql", |
| 347 |
'--clean', |
| 348 |
'--if-exists', |
| 349 |
'--encoding' => 'UTF8', # no-op, just for testing |
| 350 |
'--statistics', |
| 351 |
'postgres', |
| 352 |
], |
| 353 |
}, |
| 354 |
column_inserts => { |
| 355 |
dump_cmd => [ |
| 356 |
'pg_dump', '--no-sync', |
| 357 |
'--file' => "$tempdir/column_inserts.sql", |
| 358 |
'--data-only', |
| 359 |
'--column-inserts', 'postgres', |
| 360 |
], |
| 361 |
}, |
| 362 |
createdb => { |
| 363 |
dump_cmd => [ |
| 364 |
'pg_dump', '--no-sync', |
| 365 |
'--file' => "$tempdir/createdb.sql", |
| 366 |
'--create', |
| 367 |
'--no-reconnect', # no-op, just for testing |
| 368 |
'--verbose', |
| 369 |
'--statistics', |
| 370 |
'postgres', |
| 371 |
], |
| 372 |
}, |
| 373 |
data_only => { |
| 374 |
dump_cmd => [ |
| 375 |
'pg_dump', '--no-sync', |
| 376 |
'--file' => "$tempdir/data_only.sql", |
| 377 |
'--data-only', |
| 378 |
'--superuser' => 'test_superuser', |
| 379 |
'--disable-triggers', |
| 380 |
'--verbose', # no-op, just make sure it works |
| 381 |
'postgres', |
| 382 |
], |
| 383 |
}, |
| 384 |
defaults => { |
| 385 |
dump_cmd => [ |
| 386 |
'pg_dump', '--no-sync', |
| 387 |
'--file' => "$tempdir/defaults.sql", |
| 388 |
'--statistics', |
| 389 |
'postgres', |
| 390 |
], |
| 391 |
}, |
| 392 |
defaults_no_public => { |
| 393 |
database => 'regress_pg_dump_test', |
| 394 |
dump_cmd => [ |
| 395 |
'pg_dump', '--no-sync', |
| 396 |
'--file' => "$tempdir/defaults_no_public.sql", |
| 397 |
'--statistics', |
| 398 |
'regress_pg_dump_test', |
| 399 |
], |
| 400 |
}, |
| 401 |
defaults_no_public_clean => { |
| 402 |
database => 'regress_pg_dump_test', |
| 403 |
dump_cmd => [ |
| 404 |
'pg_dump', '--no-sync', |
| 405 |
'--clean', |
| 406 |
'--file' => "$tempdir/defaults_no_public_clean.sql", |
| 407 |
'--statistics', |
| 408 |
'regress_pg_dump_test', |
| 409 |
], |
| 410 |
}, |
| 411 |
defaults_public_owner => { |
| 412 |
database => 'regress_public_owner', |
| 413 |
dump_cmd => [ |
| 414 |
'pg_dump', '--no-sync', |
| 415 |
'--file' => "$tempdir/defaults_public_owner.sql", |
| 416 |
'--statistics', |
| 417 |
'regress_public_owner', |
| 418 |
], |
| 419 |
}, |
| 420 |
|
| 421 |
# Do not use --no-sync to give test coverage for data sync. |
| 422 |
# By default, the custom format compresses its data file |
| 423 |
# when the code is compiled with gzip support, and lets them |
| 424 |
# uncompressed when not compiled with it. |
| 425 |
defaults_custom_format => { |
| 426 |
test_key => 'defaults', |
| 427 |
dump_cmd => [ |
| 428 |
'pg_dump', |
| 429 |
'--format' => 'custom', |
| 430 |
'--file' => "$tempdir/defaults_custom_format.dump", |
| 431 |
'--statistics', |
| 432 |
'postgres', |
| 433 |
], |
| 434 |
restore_cmd => [ |
| 435 |
'pg_restore', |
| 436 |
'--format' => 'custom', |
| 437 |
'--file' => "$tempdir/defaults_custom_format.sql", |
| 438 |
'--statistics', |
| 439 |
"$tempdir/defaults_custom_format.dump", |
| 440 |
], |
| 441 |
command_like => { |
| 442 |
command => [ |
| 443 |
'pg_restore', '--list', |
| 444 |
"$tempdir/defaults_custom_format.dump", |
| 445 |
], |
| 446 |
expected => $supports_gzip |
| 447 |
? qr/Compression: gzip/ |
| 448 |
: qr/Compression: none/, |
| 449 |
name => 'data content is gzip-compressed by default if available', |
| 450 |
}, |
| 451 |
}, |
| 452 |
|
| 453 |
# Do not use --no-sync to give test coverage for data sync. |
| 454 |
# By default, the directory format compresses its data files |
| 455 |
# when the code is compiled with gzip support, and lets them |
| 456 |
# uncompressed when not compiled with it. |
| 457 |
defaults_dir_format => { |
| 458 |
test_key => 'defaults', |
| 459 |
dump_cmd => [ |
| 460 |
'pg_dump', |
| 461 |
'--format' => 'directory', |
| 462 |
'--file' => "$tempdir/defaults_dir_format", |
| 463 |
'--statistics', |
| 464 |
'postgres', |
| 465 |
], |
| 466 |
restore_cmd => [ |
| 467 |
'pg_restore', |
| 468 |
'--format' => 'directory', |
| 469 |
'--file' => "$tempdir/defaults_dir_format.sql", |
| 470 |
'--statistics', |
| 471 |
"$tempdir/defaults_dir_format", |
| 472 |
], |
| 473 |
command_like => { |
| 474 |
command => |
| 475 |
[ 'pg_restore', '--list', "$tempdir/defaults_dir_format", ], |
| 476 |
expected => $supports_gzip ? qr/Compression: gzip/ |
| 477 |
: qr/Compression: none/, |
| 478 |
name => 'data content is gzip-compressed by default', |
| 479 |
}, |
| 480 |
glob_patterns => [ |
| 481 |
"$tempdir/defaults_dir_format/toc.dat", |
| 482 |
"$tempdir/defaults_dir_format/blobs_*.toc", |
| 483 |
$supports_gzip ? "$tempdir/defaults_dir_format/*.dat.gz" |
| 484 |
: "$tempdir/defaults_dir_format/*.dat", |
| 485 |
], |
| 486 |
}, |
| 487 |
|
| 488 |
# Do not use --no-sync to give test coverage for data sync. |
| 489 |
defaults_parallel => { |
| 490 |
test_key => 'defaults', |
| 491 |
dump_cmd => [ |
| 492 |
'pg_dump', |
| 493 |
'--format' => 'directory', |
| 494 |
'--jobs' => 2, |
| 495 |
'--file' => "$tempdir/defaults_parallel", |
| 496 |
'--statistics', |
| 497 |
'postgres', |
| 498 |
], |
| 499 |
restore_cmd => [ |
| 500 |
'pg_restore', |
| 501 |
'--file' => "$tempdir/defaults_parallel.sql", |
| 502 |
'--statistics', |
| 503 |
"$tempdir/defaults_parallel", |
| 504 |
], |
| 505 |
}, |
| 506 |
|
| 507 |
# Do not use --no-sync to give test coverage for data sync. |
| 508 |
defaults_tar_format => { |
| 509 |
test_key => 'defaults', |
| 510 |
dump_cmd => [ |
| 511 |
'pg_dump', |
| 512 |
'--format' => 'tar', |
| 513 |
'--file' => "$tempdir/defaults_tar_format.tar", |
| 514 |
'--statistics', |
| 515 |
'postgres', |
| 516 |
], |
| 517 |
restore_cmd => [ |
| 518 |
'pg_restore', |
| 519 |
'--format' => 'tar', |
| 520 |
'--file' => "$tempdir/defaults_tar_format.sql", |
| 521 |
'--statistics', |
| 522 |
"$tempdir/defaults_tar_format.tar", |
| 523 |
], |
| 524 |
}, |
| 525 |
exclude_dump_test_schema => { |
| 526 |
dump_cmd => [ |
| 527 |
'pg_dump', '--no-sync', |
| 528 |
'--file' => "$tempdir/exclude_dump_test_schema.sql", |
| 529 |
'--exclude-schema' => 'dump_test', |
| 530 |
'--statistics', |
| 531 |
'postgres', |
| 532 |
], |
| 533 |
}, |
| 534 |
exclude_test_table => { |
| 535 |
dump_cmd => [ |
| 536 |
'pg_dump', '--no-sync', |
| 537 |
'--file' => "$tempdir/exclude_test_table.sql", |
| 538 |
'--exclude-table' => 'dump_test.test_table', |
| 539 |
'--statistics', |
| 540 |
'postgres', |
| 541 |
], |
| 542 |
}, |
| 543 |
exclude_measurement => { |
| 544 |
dump_cmd => [ |
| 545 |
'pg_dump', '--no-sync', |
| 546 |
'--file' => "$tempdir/exclude_measurement.sql", |
| 547 |
'--exclude-table-and-children' => 'dump_test.measurement', |
| 548 |
'--statistics', |
| 549 |
'postgres', |
| 550 |
], |
| 551 |
}, |
| 552 |
exclude_measurement_data => { |
| 553 |
dump_cmd => [ |
| 554 |
'pg_dump', '--no-sync', |
| 555 |
'--file' => "$tempdir/exclude_measurement_data.sql", |
| 556 |
'--exclude-table-data-and-children' => 'dump_test.measurement', |
| 557 |
'--no-unlogged-table-data', |
| 558 |
'--statistics', |
| 559 |
'postgres', |
| 560 |
], |
| 561 |
}, |
| 562 |
exclude_test_table_data => { |
| 563 |
dump_cmd => [ |
| 564 |
'pg_dump', '--no-sync', |
| 565 |
'--file' => "$tempdir/exclude_test_table_data.sql", |
| 566 |
'--exclude-table-data' => 'dump_test.test_table', |
| 567 |
'--no-unlogged-table-data', |
| 568 |
'--statistics', |
| 569 |
'postgres', |
| 570 |
], |
| 571 |
}, |
| 572 |
inserts => { |
| 573 |
dump_cmd => [ |
| 574 |
'pg_dump', '--no-sync', |
| 575 |
'--file' => "$tempdir/inserts.sql", |
| 576 |
'--data-only', |
| 577 |
'--inserts', 'postgres', |
| 578 |
], |
| 579 |
}, |
| 580 |
pg_dumpall_globals => { |
| 581 |
dump_cmd => [ |
| 582 |
'pg_dumpall', |
| 583 |
'--verbose', |
| 584 |
'--file' => "$tempdir/pg_dumpall_globals.sql", |
| 585 |
'--globals-only', |
| 586 |
'--no-sync', |
| 587 |
'--statistics', |
| 588 |
], |
| 589 |
}, |
| 590 |
pg_dumpall_globals_clean => { |
| 591 |
dump_cmd => [ |
| 592 |
'pg_dumpall', |
| 593 |
'--file' => "$tempdir/pg_dumpall_globals_clean.sql", |
| 594 |
'--globals-only', |
| 595 |
'--clean', |
| 596 |
'--no-sync', |
| 597 |
'--statistics', |
| 598 |
], |
| 599 |
}, |
| 600 |
pg_dumpall_dbprivs => { |
| 601 |
dump_cmd => [ |
| 602 |
'pg_dumpall', '--no-sync', |
| 603 |
'--file' => "$tempdir/pg_dumpall_dbprivs.sql", |
| 604 |
'--statistics', |
| 605 |
], |
| 606 |
}, |
| 607 |
pg_dumpall_exclude => { |
| 608 |
dump_cmd => [ |
| 609 |
'pg_dumpall', |
| 610 |
'--verbose', |
| 611 |
'--file' => "$tempdir/pg_dumpall_exclude.sql", |
| 612 |
'--exclude-database' => '*dump_test*', |
| 613 |
'--no-sync', |
| 614 |
'--statistics', |
| 615 |
], |
| 616 |
}, |
| 617 |
no_toast_compression => { |
| 618 |
dump_cmd => [ |
| 619 |
'pg_dump', '--no-sync', |
| 620 |
'--file' => "$tempdir/no_toast_compression.sql", |
| 621 |
'--no-toast-compression', |
| 622 |
'--statistics', |
| 623 |
'postgres', |
| 624 |
], |
| 625 |
}, |
| 626 |
no_large_objects => { |
| 627 |
dump_cmd => [ |
| 628 |
'pg_dump', '--no-sync', |
| 629 |
'--file' => "$tempdir/no_large_objects.sql", |
| 630 |
'--no-large-objects', |
| 631 |
'--statistics', |
| 632 |
'postgres', |
| 633 |
], |
| 634 |
}, |
| 635 |
no_policies => { |
| 636 |
dump_cmd => [ |
| 637 |
'pg_dump', '--no-sync', |
| 638 |
'--file' => "$tempdir/no_policies.sql", |
| 639 |
'--no-policies', |
| 640 |
'--statistics', |
| 641 |
'postgres', |
| 642 |
], |
| 643 |
}, |
| 644 |
no_policies_restore => { |
| 645 |
dump_cmd => [ |
| 646 |
'pg_dump', '--no-sync', |
| 647 |
'--format' => 'custom', |
| 648 |
'--file' => "$tempdir/no_policies_restore.dump", |
| 649 |
'--statistics', |
| 650 |
'postgres', |
| 651 |
], |
| 652 |
restore_cmd => [ |
| 653 |
'pg_restore', |
| 654 |
'--format' => 'custom', |
| 655 |
'--file' => "$tempdir/no_policies_restore.sql", |
| 656 |
'--no-policies', |
| 657 |
'--statistics', |
| 658 |
"$tempdir/no_policies_restore.dump", |
| 659 |
], |
| 660 |
}, |
| 661 |
no_privs => { |
| 662 |
dump_cmd => [ |
| 663 |
'pg_dump', '--no-sync', |
| 664 |
'--file' => "$tempdir/no_privs.sql", |
| 665 |
'--no-privileges', |
| 666 |
'--statistics', |
| 667 |
'postgres', |
| 668 |
], |
| 669 |
}, |
| 670 |
no_owner => { |
| 671 |
dump_cmd => [ |
| 672 |
'pg_dump', '--no-sync', |
| 673 |
'--file' => "$tempdir/no_owner.sql", |
| 674 |
'--no-owner', |
| 675 |
'--statistics', |
| 676 |
'postgres', |
| 677 |
], |
| 678 |
}, |
| 679 |
no_subscriptions => { |
| 680 |
dump_cmd => [ |
| 681 |
'pg_dump', '--no-sync', |
| 682 |
'--file' => "$tempdir/no_subscriptions.sql", |
| 683 |
'--no-subscriptions', |
| 684 |
'--statistics', |
| 685 |
'postgres', |
| 686 |
], |
| 687 |
}, |
| 688 |
no_subscriptions_restore => { |
| 689 |
dump_cmd => [ |
| 690 |
'pg_dump', '--no-sync', |
| 691 |
'--format' => 'custom', |
| 692 |
'--file' => "$tempdir/no_subscriptions_restore.dump", |
| 693 |
'--statistics', |
| 694 |
'postgres', |
| 695 |
], |
| 696 |
restore_cmd => [ |
| 697 |
'pg_restore', |
| 698 |
'--format' => 'custom', |
| 699 |
'--file' => "$tempdir/no_subscriptions_restore.sql", |
| 700 |
'--no-subscriptions', |
| 701 |
'--statistics', |
| 702 |
"$tempdir/no_subscriptions_restore.dump", |
| 703 |
], |
| 704 |
}, |
| 705 |
no_table_access_method => { |
| 706 |
dump_cmd => [ |
| 707 |
'pg_dump', '--no-sync', |
| 708 |
'--file' => "$tempdir/no_table_access_method.sql", |
| 709 |
'--no-table-access-method', |
| 710 |
'--statistics', |
| 711 |
'postgres', |
| 712 |
], |
| 713 |
}, |
| 714 |
only_dump_test_schema => { |
| 715 |
dump_cmd => [ |
| 716 |
'pg_dump', '--no-sync', |
| 717 |
'--file' => "$tempdir/only_dump_test_schema.sql", |
| 718 |
'--schema' => 'dump_test', |
| 719 |
'--statistics', |
| 720 |
'postgres', |
| 721 |
], |
| 722 |
}, |
| 723 |
only_dump_test_table => { |
| 724 |
dump_cmd => [ |
| 725 |
'pg_dump', '--no-sync', |
| 726 |
'--file' => "$tempdir/only_dump_test_table.sql", |
| 727 |
'--table' => 'dump_test.test_table', |
| 728 |
'--lock-wait-timeout' => |
| 729 |
(1000 * $PostgreSQL::Test::Utils::timeout_default), |
| 730 |
'--statistics', |
| 731 |
'postgres', |
| 732 |
], |
| 733 |
}, |
| 734 |
only_dump_measurement => { |
| 735 |
dump_cmd => [ |
| 736 |
'pg_dump', '--no-sync', |
| 737 |
'--file' => "$tempdir/only_dump_measurement.sql", |
| 738 |
'--table-and-children' => 'dump_test.measurement', |
| 739 |
'--lock-wait-timeout' => |
| 740 |
(1000 * $PostgreSQL::Test::Utils::timeout_default), |
| 741 |
'--statistics', |
| 742 |
'postgres', |
| 743 |
], |
| 744 |
}, |
| 745 |
role => { |
| 746 |
dump_cmd => [ |
| 747 |
'pg_dump', '--no-sync', |
| 748 |
'--file' => "$tempdir/role.sql", |
| 749 |
'--role' => 'regress_dump_test_role', |
| 750 |
'--schema' => 'dump_test_second_schema', |
| 751 |
'--statistics', |
| 752 |
'postgres', |
| 753 |
], |
| 754 |
}, |
| 755 |
role_parallel => { |
| 756 |
test_key => 'role', |
| 757 |
dump_cmd => [ |
| 758 |
'pg_dump', '--no-sync', |
| 759 |
'--format' => 'directory', |
| 760 |
'--jobs' => '2', |
| 761 |
'--file' => "$tempdir/role_parallel", |
| 762 |
'--role' => 'regress_dump_test_role', |
| 763 |
'--schema' => 'dump_test_second_schema', |
| 764 |
'--statistics', |
| 765 |
'postgres', |
| 766 |
], |
| 767 |
restore_cmd => [ |
| 768 |
'pg_restore', |
| 769 |
'--file' => "$tempdir/role_parallel.sql", |
| 770 |
'--statistics', |
| 771 |
"$tempdir/role_parallel", |
| 772 |
], |
| 773 |
}, |
| 774 |
rows_per_insert => { |
| 775 |
dump_cmd => [ |
| 776 |
'pg_dump', '--no-sync', |
| 777 |
'--file' => "$tempdir/rows_per_insert.sql", |
| 778 |
'--data-only', |
| 779 |
'--rows-per-insert' => '4', |
| 780 |
'--table' => 'dump_test.test_table', |
| 781 |
'--table' => 'dump_test.test_fourth_table', |
| 782 |
'postgres', |
| 783 |
], |
| 784 |
}, |
| 785 |
schema_only => { |
| 786 |
dump_cmd => [ |
| 787 |
'pg_dump', '--no-sync', |
| 788 |
'--format' => 'plain', |
| 789 |
'--file' => "$tempdir/schema_only.sql", |
| 790 |
'--schema-only', |
| 791 |
'postgres', |
| 792 |
], |
| 793 |
}, |
| 794 |
section_pre_data => { |
| 795 |
dump_cmd => [ |
| 796 |
'pg_dump', '--no-sync', |
| 797 |
'--file' => "$tempdir/section_pre_data.sql", |
| 798 |
'--section' => 'pre-data', |
| 799 |
'--statistics', |
| 800 |
'postgres', |
| 801 |
], |
| 802 |
}, |
| 803 |
section_data => { |
| 804 |
dump_cmd => [ |
| 805 |
'pg_dump', '--no-sync', |
| 806 |
'--file' => "$tempdir/section_data.sql", |
| 807 |
'--section' => 'data', |
| 808 |
'--statistics', |
| 809 |
'postgres', |
| 810 |
], |
| 811 |
}, |
| 812 |
section_post_data => { |
| 813 |
dump_cmd => [ |
| 814 |
'pg_dump', '--no-sync', |
| 815 |
'--file' => "$tempdir/section_post_data.sql", |
| 816 |
'--section' => 'post-data', |
| 817 |
'--statistics', |
| 818 |
'postgres', |
| 819 |
], |
| 820 |
}, |
| 821 |
test_schema_plus_large_objects => { |
| 822 |
dump_cmd => [ |
| 823 |
'pg_dump', '--no-sync', |
| 824 |
'--file' => "$tempdir/test_schema_plus_large_objects.sql", |
| 825 |
'--schema' => 'dump_test', |
| 826 |
'--large-objects', |
| 827 |
'--no-large-objects', |
| 828 |
'--statistics', |
| 829 |
'postgres', |
| 830 |
], |
| 831 |
}, |
| 832 |
no_statistics => { |
| 833 |
dump_cmd => [ |
| 834 |
'pg_dump', '--no-sync', |
| 835 |
"--file=$tempdir/no_statistics.sql", '--no-statistics', |
| 836 |
'postgres', |
| 837 |
], |
| 838 |
}, |
| 839 |
no_data_no_schema => { |
| 840 |
dump_cmd => [ |
| 841 |
'pg_dump', '--no-sync', |
| 842 |
"--file=$tempdir/no_data_no_schema.sql", '--no-data', |
| 843 |
'--no-schema', 'postgres', |
| 844 |
'--statistics', |
| 845 |
], |
| 846 |
}, |
| 847 |
statistics_only => { |
| 848 |
dump_cmd => [ |
| 849 |
'pg_dump', '--no-sync', |
| 850 |
"--file=$tempdir/statistics_only.sql", '--statistics-only', |
| 851 |
'postgres', |
| 852 |
], |
| 853 |
}, |
| 854 |
statistics_only_with_schema => { |
| 855 |
dump_cmd => [ |
| 856 |
'pg_dump', '--no-sync', |
| 857 |
'--format' => 'custom', |
| 858 |
'--file' => "$tempdir/statistics_only_with_schema.dump", |
| 859 |
'--statistics-only', |
| 860 |
'--schema' => 'dump_test', |
| 861 |
'postgres', |
| 862 |
], |
| 863 |
restore_cmd => [ |
| 864 |
'pg_restore', |
| 865 |
'--format' => 'custom', |
| 866 |
'--file' => "$tempdir/statistics_only_with_schema.sql", |
| 867 |
'--statistics-only', |
| 868 |
'--schema' => 'dump_test', |
| 869 |
"$tempdir/statistics_only_with_schema.dump", |
| 870 |
], |
| 871 |
}, |
| 872 |
statistics_only_with_table => { |
| 873 |
dump_cmd => [ |
| 874 |
'pg_dump', '--no-sync', |
| 875 |
'--format' => 'custom', |
| 876 |
'--file' => "$tempdir/statistics_only_with_table.dump", |
| 877 |
'--statistics', |
| 878 |
'postgres', |
| 879 |
], |
| 880 |
restore_cmd => [ |
| 881 |
'pg_restore', |
| 882 |
'--format' => 'custom', |
| 883 |
'--file' => "$tempdir/statistics_only_with_table.sql", |
| 884 |
'--statistics-only', |
| 885 |
'--table' => 'test_table', |
| 886 |
'--schema' => 'dump_test', |
| 887 |
"$tempdir/statistics_only_with_table.dump", |
| 888 |
], |
| 889 |
}, |
| 890 |
statistics_only_with_index => { |
| 891 |
dump_cmd => [ |
| 892 |
'pg_dump', '--no-sync', |
| 893 |
'--format' => 'custom', |
| 894 |
'--file' => "$tempdir/statistics_only_with_index.dump", |
| 895 |
'--statistics', |
| 896 |
'postgres', |
| 897 |
], |
| 898 |
restore_cmd => [ |
| 899 |
'pg_restore', |
| 900 |
'--format' => 'custom', |
| 901 |
'--file' => "$tempdir/statistics_only_with_index.sql", |
| 902 |
'--statistics-only', |
| 903 |
'--index' => '"dump_test"\'s post-data index', |
| 904 |
'--schema' => 'dump_test', |
| 905 |
"$tempdir/statistics_only_with_index.dump", |
| 906 |
], |
| 907 |
}, |
| 908 |
no_schema => { |
| 909 |
dump_cmd => [ |
| 910 |
'pg_dump', '--no-sync', |
| 911 |
"--file=$tempdir/no_schema.sql", '--no-schema', |
| 912 |
'--statistics', 'postgres', |
| 913 |
], |
| 914 |
},); |
| 915 |
|
| 916 |
############################################################### |
| 917 |
# Definition of the tests to run. |
| 918 |
# |
| 919 |
# Each test is defined using the log message that will be used. |
| 920 |
# |
| 921 |
# A regexp should be defined for each test which provides the |
| 922 |
# basis for the test. That regexp will be run against the output |
| 923 |
# file of each of the runs which the test is to be run against |
| 924 |
# and the success of the result will depend on if the regexp |
| 925 |
# result matches the expected 'like' or 'unlike' case. |
| 926 |
# |
| 927 |
# The runs listed as 'like' will be checked if they match the |
| 928 |
# regexp and, if so, the test passes. All runs which are not |
| 929 |
# listed as 'like' will be checked to ensure they don't match |
| 930 |
# the regexp; if they do, the test will fail. |
| 931 |
# |
| 932 |
# The below hashes provide convenience sets of runs. Individual |
| 933 |
# runs can be excluded from a general hash by placing that run |
| 934 |
# into the 'unlike' section. |
| 935 |
# |
| 936 |
# For example, there is an 'exclude_test_table' run which runs a |
| 937 |
# full pg_dump but with an exclude flag to not include the test |
| 938 |
# table. The CREATE TABLE test which creates the test table is |
| 939 |
# defined with %full_runs but then has 'exclude_test_table' in |
| 940 |
# its 'unlike' list, excluding that test. |
| 941 |
# |
| 942 |
# There can then be a 'create_sql' and 'create_order' for a |
| 943 |
# given test. The 'create_sql' commands are collected up in |
| 944 |
# 'create_order' and then run against the database prior to any |
| 945 |
# of the pg_dump runs happening. This is what "seeds" the |
| 946 |
# system with objects to be dumped out. |
| 947 |
# |
| 948 |
# There can be a flag called 'lz4', which can be set if the test |
| 949 |
# case depends on LZ4. Tests marked with this flag are skipped if |
| 950 |
# the build used does not support LZ4. |
| 951 |
# |
| 952 |
# Building of this hash takes a bit of time as all of the regexps |
| 953 |
# included in it are compiled. This greatly improves performance |
| 954 |
# as the regexps are used for each run the test applies to. |
| 955 |
|
| 956 |
# Tests which target the 'dump_test' schema, specifically. |
| 957 |
my %dump_test_schema_runs = ( |
| 958 |
only_dump_test_schema => 1, |
| 959 |
only_dump_measurement => 1, |
| 960 |
test_schema_plus_large_objects => 1,); |
| 961 |
|
| 962 |
# Tests which are considered 'full' dumps by pg_dump, but there |
| 963 |
# are flags used to exclude specific items (ACLs, LOs, etc). |
| 964 |
my %full_runs = ( |
| 965 |
binary_upgrade => 1, |
| 966 |
clean => 1, |
| 967 |
clean_if_exists => 1, |
| 968 |
compression => 1, |
| 969 |
createdb => 1, |
| 970 |
defaults => 1, |
| 971 |
exclude_dump_test_schema => 1, |
| 972 |
exclude_test_table => 1, |
| 973 |
exclude_test_table_data => 1, |
| 974 |
exclude_measurement => 1, |
| 975 |
exclude_measurement_data => 1, |
| 976 |
no_toast_compression => 1, |
| 977 |
no_large_objects => 1, |
| 978 |
no_owner => 1, |
| 979 |
no_policies => 1, |
| 980 |
no_policies_restore => 1, |
| 981 |
no_privs => 1, |
| 982 |
no_statistics => 1, |
| 983 |
no_subscriptions => 1, |
| 984 |
no_subscriptions_restore => 1, |
| 985 |
no_table_access_method => 1, |
| 986 |
pg_dumpall_dbprivs => 1, |
| 987 |
pg_dumpall_exclude => 1, |
| 988 |
schema_only => 1,); |
| 989 |
|
| 990 |
# This is where the actual tests are defined. |
| 991 |
my %tests = ( |
| 992 |
'restrict' => { |
| 993 |
all_runs => 1, |
| 994 |
regexp => qr/^\\restrict [a-zA-Z0-9]+$/m, |
| 995 |
}, |
| 996 |
|
| 997 |
'unrestrict' => { |
| 998 |
all_runs => 1, |
| 999 |
regexp => qr/^\\unrestrict [a-zA-Z0-9]+$/m, |
| 1000 |
}, |
| 1001 |
|
| 1002 |
'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role GRANT' => { |
| 1003 |
create_order => 14, |
| 1004 |
create_sql => 'ALTER DEFAULT PRIVILEGES |
| 1005 |
FOR ROLE regress_dump_test_role IN SCHEMA dump_test |
| 1006 |
GRANT SELECT ON TABLES TO regress_dump_test_role;', |
| 1007 |
regexp => qr/^ |
| 1008 |
\QALTER DEFAULT PRIVILEGES \E |
| 1009 |
\QFOR ROLE regress_dump_test_role IN SCHEMA dump_test \E |
| 1010 |
\QGRANT SELECT ON TABLES TO regress_dump_test_role;\E |
| 1011 |
/xm, |
| 1012 |
like => |
| 1013 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 1014 |
unlike => { |
| 1015 |
exclude_dump_test_schema => 1, |
| 1016 |
no_privs => 1, |
| 1017 |
only_dump_measurement => 1, |
| 1018 |
}, |
| 1019 |
}, |
| 1020 |
|
| 1021 |
'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role GRANT EXECUTE ON FUNCTIONS' |
| 1022 |
=> { |
| 1023 |
create_order => 15, |
| 1024 |
create_sql => 'ALTER DEFAULT PRIVILEGES |
| 1025 |
FOR ROLE regress_dump_test_role IN SCHEMA dump_test |
| 1026 |
GRANT EXECUTE ON FUNCTIONS TO regress_dump_test_role;', |
| 1027 |
regexp => qr/^ |
| 1028 |
\QALTER DEFAULT PRIVILEGES \E |
| 1029 |
\QFOR ROLE regress_dump_test_role IN SCHEMA dump_test \E |
| 1030 |
\QGRANT ALL ON FUNCTIONS TO regress_dump_test_role;\E |
| 1031 |
/xm, |
| 1032 |
like => |
| 1033 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 1034 |
unlike => { |
| 1035 |
exclude_dump_test_schema => 1, |
| 1036 |
no_privs => 1, |
| 1037 |
only_dump_measurement => 1, |
| 1038 |
}, |
| 1039 |
}, |
| 1040 |
|
| 1041 |
'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role REVOKE' => { |
| 1042 |
create_order => 55, |
| 1043 |
create_sql => 'ALTER DEFAULT PRIVILEGES |
| 1044 |
FOR ROLE regress_dump_test_role |
| 1045 |
REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;', |
| 1046 |
regexp => qr/^ |
| 1047 |
\QALTER DEFAULT PRIVILEGES \E |
| 1048 |
\QFOR ROLE regress_dump_test_role \E |
| 1049 |
\QREVOKE ALL ON FUNCTIONS FROM PUBLIC;\E |
| 1050 |
/xm, |
| 1051 |
like => { %full_runs, section_post_data => 1, }, |
| 1052 |
unlike => { no_privs => 1, }, |
| 1053 |
}, |
| 1054 |
|
| 1055 |
'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role REVOKE SELECT' |
| 1056 |
=> { |
| 1057 |
create_order => 56, |
| 1058 |
create_sql => 'ALTER DEFAULT PRIVILEGES |
| 1059 |
FOR ROLE regress_dump_test_role |
| 1060 |
REVOKE SELECT ON TABLES FROM regress_dump_test_role;', |
| 1061 |
regexp => qr/^ |
| 1062 |
\QALTER DEFAULT PRIVILEGES \E |
| 1063 |
\QFOR ROLE regress_dump_test_role \E |
| 1064 |
\QREVOKE ALL ON TABLES FROM regress_dump_test_role;\E\n |
| 1065 |
\QALTER DEFAULT PRIVILEGES \E |
| 1066 |
\QFOR ROLE regress_dump_test_role \E |
| 1067 |
\QGRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLES TO regress_dump_test_role;\E |
| 1068 |
/xm, |
| 1069 |
like => { %full_runs, section_post_data => 1, }, |
| 1070 |
unlike => { no_privs => 1, }, |
| 1071 |
}, |
| 1072 |
|
| 1073 |
'ALTER ROLE regress_dump_test_role' => { |
| 1074 |
regexp => qr/^ |
| 1075 |
\QALTER ROLE regress_dump_test_role WITH \E |
| 1076 |
\QNOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB NOLOGIN \E |
| 1077 |
\QNOREPLICATION NOBYPASSRLS;\E |
| 1078 |
/xm, |
| 1079 |
like => { |
| 1080 |
pg_dumpall_dbprivs => 1, |
| 1081 |
pg_dumpall_globals => 1, |
| 1082 |
pg_dumpall_globals_clean => 1, |
| 1083 |
pg_dumpall_exclude => 1, |
| 1084 |
}, |
| 1085 |
}, |
| 1086 |
|
| 1087 |
'ALTER COLLATION test0 OWNER TO' => { |
| 1088 |
regexp => qr/^\QALTER COLLATION public.test0 OWNER TO \E.+;/m, |
| 1089 |
collation => 1, |
| 1090 |
like => { %full_runs, section_pre_data => 1, }, |
| 1091 |
unlike => { no_owner => 1, }, |
| 1092 |
}, |
| 1093 |
|
| 1094 |
'ALTER FOREIGN DATA WRAPPER dummy OWNER TO' => { |
| 1095 |
regexp => qr/^ALTER FOREIGN DATA WRAPPER dummy OWNER TO .+;/m, |
| 1096 |
like => { %full_runs, section_pre_data => 1, }, |
| 1097 |
unlike => { no_owner => 1, }, |
| 1098 |
}, |
| 1099 |
|
| 1100 |
'ALTER SERVER s1 OWNER TO' => { |
| 1101 |
regexp => qr/^ALTER SERVER s1 OWNER TO .+;/m, |
| 1102 |
like => { %full_runs, section_pre_data => 1, }, |
| 1103 |
unlike => { no_owner => 1, }, |
| 1104 |
}, |
| 1105 |
|
| 1106 |
'ALTER FUNCTION dump_test.pltestlang_call_handler() OWNER TO' => { |
| 1107 |
regexp => qr/^ |
| 1108 |
\QALTER FUNCTION dump_test.pltestlang_call_handler() \E |
| 1109 |
\QOWNER TO \E |
| 1110 |
.+;/xm, |
| 1111 |
like => |
| 1112 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1113 |
unlike => { |
| 1114 |
exclude_dump_test_schema => 1, |
| 1115 |
no_owner => 1, |
| 1116 |
only_dump_measurement => 1, |
| 1117 |
}, |
| 1118 |
}, |
| 1119 |
|
| 1120 |
'ALTER OPERATOR FAMILY dump_test.op_family OWNER TO' => { |
| 1121 |
regexp => qr/^ |
| 1122 |
\QALTER OPERATOR FAMILY dump_test.op_family USING btree \E |
| 1123 |
\QOWNER TO \E |
| 1124 |
.+;/xm, |
| 1125 |
like => |
| 1126 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1127 |
unlike => { |
| 1128 |
exclude_dump_test_schema => 1, |
| 1129 |
no_owner => 1, |
| 1130 |
only_dump_measurement => 1, |
| 1131 |
}, |
| 1132 |
}, |
| 1133 |
|
| 1134 |
'ALTER OPERATOR FAMILY dump_test.op_family USING btree' => { |
| 1135 |
create_order => 75, |
| 1136 |
create_sql => |
| 1137 |
'ALTER OPERATOR FAMILY dump_test.op_family USING btree ADD |
| 1138 |
OPERATOR 1 <(bigint,int4), |
| 1139 |
OPERATOR 2 <=(bigint,int4), |
| 1140 |
OPERATOR 3 =(bigint,int4), |
| 1141 |
OPERATOR 4 >=(bigint,int4), |
| 1142 |
OPERATOR 5 >(bigint,int4), |
| 1143 |
FUNCTION 1 (int4, int4) btint4cmp(int4,int4), |
| 1144 |
FUNCTION 2 (int4, int4) btint4sortsupport(internal), |
| 1145 |
FUNCTION 4 (int4, int4) btequalimage(oid);', |
| 1146 |
# note: it's correct that btint8sortsupport and bigint btequalimage |
| 1147 |
# are included here: |
| 1148 |
regexp => qr/^ |
| 1149 |
\QALTER OPERATOR FAMILY dump_test.op_family USING btree ADD\E\n\s+ |
| 1150 |
\QOPERATOR 1 <(bigint,integer) ,\E\n\s+ |
| 1151 |
\QOPERATOR 2 <=(bigint,integer) ,\E\n\s+ |
| 1152 |
\QOPERATOR 3 =(bigint,integer) ,\E\n\s+ |
| 1153 |
\QOPERATOR 4 >=(bigint,integer) ,\E\n\s+ |
| 1154 |
\QOPERATOR 5 >(bigint,integer) ,\E\n\s+ |
| 1155 |
\QFUNCTION 1 (integer, integer) btint4cmp(integer,integer) ,\E\n\s+ |
| 1156 |
\QFUNCTION 2 (bigint, bigint) btint8sortsupport(internal) ,\E\n\s+ |
| 1157 |
\QFUNCTION 2 (integer, integer) btint4sortsupport(internal) ,\E\n\s+ |
| 1158 |
\QFUNCTION 4 (bigint, bigint) btequalimage(oid) ,\E\n\s+ |
| 1159 |
\QFUNCTION 4 (integer, integer) btequalimage(oid);\E |
| 1160 |
/xm, |
| 1161 |
like => |
| 1162 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1163 |
unlike => { |
| 1164 |
exclude_dump_test_schema => 1, |
| 1165 |
only_dump_measurement => 1, |
| 1166 |
}, |
| 1167 |
}, |
| 1168 |
|
| 1169 |
'ALTER OPERATOR CLASS dump_test.op_class OWNER TO' => { |
| 1170 |
regexp => qr/^ |
| 1171 |
\QALTER OPERATOR CLASS dump_test.op_class USING btree \E |
| 1172 |
\QOWNER TO \E |
| 1173 |
.+;/xm, |
| 1174 |
like => |
| 1175 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1176 |
unlike => { |
| 1177 |
exclude_dump_test_schema => 1, |
| 1178 |
no_owner => 1, |
| 1179 |
only_dump_measurement => 1, |
| 1180 |
}, |
| 1181 |
}, |
| 1182 |
|
| 1183 |
'ALTER PUBLICATION pub1 OWNER TO' => { |
| 1184 |
regexp => qr/^ALTER PUBLICATION pub1 OWNER TO .+;/m, |
| 1185 |
like => { %full_runs, section_post_data => 1, }, |
| 1186 |
unlike => { no_owner => 1, }, |
| 1187 |
}, |
| 1188 |
|
| 1189 |
'ALTER LARGE OBJECT ... OWNER TO' => { |
| 1190 |
regexp => qr/^ALTER LARGE OBJECT \d+ OWNER TO .+;/m, |
| 1191 |
like => { |
| 1192 |
%full_runs, |
| 1193 |
column_inserts => 1, |
| 1194 |
data_only => 1, |
| 1195 |
inserts => 1, |
| 1196 |
no_schema => 1, |
| 1197 |
section_data => 1, |
| 1198 |
test_schema_plus_large_objects => 1, |
| 1199 |
}, |
| 1200 |
unlike => { |
| 1201 |
no_large_objects => 1, |
| 1202 |
no_owner => 1, |
| 1203 |
schema_only => 1, |
| 1204 |
}, |
| 1205 |
}, |
| 1206 |
|
| 1207 |
'ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO' => { |
| 1208 |
regexp => qr/^ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO .+;/m, |
| 1209 |
like => { %full_runs, section_pre_data => 1, }, |
| 1210 |
unlike => { no_owner => 1, }, |
| 1211 |
}, |
| 1212 |
|
| 1213 |
'ALTER SCHEMA dump_test OWNER TO' => { |
| 1214 |
regexp => qr/^ALTER SCHEMA dump_test OWNER TO .+;/m, |
| 1215 |
like => |
| 1216 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1217 |
unlike => { |
| 1218 |
exclude_dump_test_schema => 1, |
| 1219 |
no_owner => 1, |
| 1220 |
only_dump_measurement => 1, |
| 1221 |
}, |
| 1222 |
}, |
| 1223 |
|
| 1224 |
'ALTER SCHEMA dump_test_second_schema OWNER TO' => { |
| 1225 |
regexp => qr/^ALTER SCHEMA dump_test_second_schema OWNER TO .+;/m, |
| 1226 |
like => { |
| 1227 |
%full_runs, |
| 1228 |
role => 1, |
| 1229 |
section_pre_data => 1, |
| 1230 |
}, |
| 1231 |
unlike => { no_owner => 1, }, |
| 1232 |
}, |
| 1233 |
|
| 1234 |
'ALTER SCHEMA public OWNER TO' => { |
| 1235 |
create_order => 15, |
| 1236 |
create_sql => |
| 1237 |
'ALTER SCHEMA public OWNER TO "regress_quoted \"" role";', |
| 1238 |
regexp => qr/^ALTER SCHEMA public OWNER TO .+;/m, |
| 1239 |
like => { |
| 1240 |
%full_runs, section_pre_data => 1, |
| 1241 |
}, |
| 1242 |
unlike => { no_owner => 1, }, |
| 1243 |
}, |
| 1244 |
|
| 1245 |
'ALTER SCHEMA public OWNER TO (w/o ACL changes)' => { |
| 1246 |
database => 'regress_public_owner', |
| 1247 |
create_order => 100, |
| 1248 |
create_sql => |
| 1249 |
'ALTER SCHEMA public OWNER TO "regress_quoted \"" role";', |
| 1250 |
regexp => qr/^(GRANT|REVOKE)/m, |
| 1251 |
like => {}, |
| 1252 |
}, |
| 1253 |
|
| 1254 |
'ALTER SEQUENCE test_table_col1_seq' => { |
| 1255 |
regexp => qr/^ |
| 1256 |
\QALTER SEQUENCE dump_test.test_table_col1_seq OWNED BY dump_test.test_table.col1;\E |
| 1257 |
/xm, |
| 1258 |
like => { |
| 1259 |
%full_runs, |
| 1260 |
%dump_test_schema_runs, |
| 1261 |
only_dump_test_table => 1, |
| 1262 |
section_pre_data => 1, |
| 1263 |
}, |
| 1264 |
unlike => { |
| 1265 |
exclude_dump_test_schema => 1, |
| 1266 |
exclude_test_table => 1, |
| 1267 |
only_dump_measurement => 1, |
| 1268 |
}, |
| 1269 |
}, |
| 1270 |
|
| 1271 |
'ALTER TABLE ONLY test_table ADD CONSTRAINT ... PRIMARY KEY' => { |
| 1272 |
regexp => qr/^ |
| 1273 |
\QALTER TABLE ONLY dump_test.test_table\E \n^\s+ |
| 1274 |
\QADD CONSTRAINT test_table_pkey PRIMARY KEY (col1);\E |
| 1275 |
/xm, |
| 1276 |
like => { |
| 1277 |
%full_runs, |
| 1278 |
%dump_test_schema_runs, |
| 1279 |
only_dump_test_table => 1, |
| 1280 |
section_post_data => 1, |
| 1281 |
}, |
| 1282 |
unlike => { |
| 1283 |
exclude_dump_test_schema => 1, |
| 1284 |
exclude_test_table => 1, |
| 1285 |
only_dump_measurement => 1, |
| 1286 |
}, |
| 1287 |
}, |
| 1288 |
|
| 1289 |
'CONSTRAINT NOT NULL / NOT VALID' => { |
| 1290 |
create_sql => 'CREATE TABLE dump_test.test_table_nn ( |
| 1291 |
col1 int); |
| 1292 |
CREATE TABLE dump_test.test_table_nn_2 ( |
| 1293 |
col1 int NOT NULL); |
| 1294 |
CREATE TABLE dump_test.test_table_nn_chld1 ( |
| 1295 |
) INHERITS (dump_test.test_table_nn); |
| 1296 |
CREATE TABLE dump_test.test_table_nn_chld2 ( |
| 1297 |
col1 int |
| 1298 |
) INHERITS (dump_test.test_table_nn); |
| 1299 |
CREATE TABLE dump_test.test_table_nn_chld3 ( |
| 1300 |
) INHERITS (dump_test.test_table_nn, dump_test.test_table_nn_2); |
| 1301 |
ALTER TABLE dump_test.test_table_nn ADD CONSTRAINT nn NOT NULL col1 NOT VALID; |
| 1302 |
ALTER TABLE dump_test.test_table_nn_chld1 VALIDATE CONSTRAINT nn; |
| 1303 |
ALTER TABLE dump_test.test_table_nn_chld2 VALIDATE CONSTRAINT nn; |
| 1304 |
COMMENT ON CONSTRAINT nn ON dump_test.test_table_nn IS \'nn comment is valid\'; |
| 1305 |
COMMENT ON CONSTRAINT nn ON dump_test.test_table_nn_chld2 IS \'nn_chld2 comment is valid\';', |
| 1306 |
regexp => qr/^ |
| 1307 |
\QALTER TABLE dump_test.test_table_nn\E \n^\s+ |
| 1308 |
\QADD CONSTRAINT nn NOT NULL col1 NOT VALID;\E |
| 1309 |
/xm, |
| 1310 |
like => { |
| 1311 |
%full_runs, %dump_test_schema_runs, section_post_data => 1, |
| 1312 |
}, |
| 1313 |
unlike => { |
| 1314 |
exclude_dump_test_schema => 1, |
| 1315 |
only_dump_measurement => 1, |
| 1316 |
}, |
| 1317 |
}, |
| 1318 |
|
| 1319 |
# This constraint is invalid therefore it goes in SECTION_POST_DATA |
| 1320 |
'COMMENT ON CONSTRAINT ON test_table_nn' => { |
| 1321 |
regexp => qr/^ |
| 1322 |
\QCOMMENT ON CONSTRAINT nn ON dump_test.test_table_nn IS\E |
| 1323 |
/xm, |
| 1324 |
like => { |
| 1325 |
%full_runs, %dump_test_schema_runs, section_post_data => 1, |
| 1326 |
}, |
| 1327 |
unlike => { |
| 1328 |
exclude_dump_test_schema => 1, |
| 1329 |
only_dump_measurement => 1, |
| 1330 |
}, |
| 1331 |
}, |
| 1332 |
|
| 1333 |
# This constraint is valid therefore it goes in SECTION_PRE_DATA |
| 1334 |
'COMMENT ON CONSTRAINT ON test_table_chld2' => { |
| 1335 |
regexp => qr/^ |
| 1336 |
\QCOMMENT ON CONSTRAINT nn ON dump_test.test_table_nn_chld2 IS\E |
| 1337 |
/xm, |
| 1338 |
like => { |
| 1339 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 1340 |
}, |
| 1341 |
unlike => { |
| 1342 |
exclude_dump_test_schema => 1, |
| 1343 |
only_dump_measurement => 1, |
| 1344 |
}, |
| 1345 |
}, |
| 1346 |
|
| 1347 |
'CONSTRAINT NOT NULL / NOT VALID (child1)' => { |
| 1348 |
regexp => qr/^ |
| 1349 |
\QCREATE TABLE dump_test.test_table_nn_chld1 (\E\n |
| 1350 |
^\s+\QCONSTRAINT nn NOT NULL col1\E$ |
| 1351 |
/xm, |
| 1352 |
like => { |
| 1353 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 1354 |
}, |
| 1355 |
unlike => { |
| 1356 |
exclude_dump_test_schema => 1, |
| 1357 |
only_dump_measurement => 1, |
| 1358 |
binary_upgrade => 1, |
| 1359 |
}, |
| 1360 |
}, |
| 1361 |
|
| 1362 |
'CONSTRAINT NOT NULL / NOT VALID (child2)' => { |
| 1363 |
regexp => qr/^ |
| 1364 |
\QCREATE TABLE dump_test.test_table_nn_chld2 (\E\n |
| 1365 |
^\s+\Qcol1 integer CONSTRAINT nn NOT NULL\E$ |
| 1366 |
/xm, |
| 1367 |
like => { |
| 1368 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 1369 |
}, |
| 1370 |
unlike => { |
| 1371 |
exclude_dump_test_schema => 1, |
| 1372 |
only_dump_measurement => 1, |
| 1373 |
}, |
| 1374 |
}, |
| 1375 |
|
| 1376 |
'CONSTRAINT NOT NULL / NOT VALID (child3)' => { |
| 1377 |
regexp => qr/^ |
| 1378 |
\QCREATE TABLE dump_test.test_table_nn_chld3 (\E\n |
| 1379 |
^\Q)\E$ |
| 1380 |
/xm, |
| 1381 |
like => { |
| 1382 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 1383 |
}, |
| 1384 |
unlike => { |
| 1385 |
exclude_dump_test_schema => 1, |
| 1386 |
only_dump_measurement => 1, |
| 1387 |
binary_upgrade => 1, |
| 1388 |
}, |
| 1389 |
}, |
| 1390 |
|
| 1391 |
'CONSTRAINT NOT NULL / NO INHERIT' => { |
| 1392 |
create_sql => 'CREATE TABLE dump_test.test_table_nonn ( |
| 1393 |
col1 int NOT NULL NO INHERIT, |
| 1394 |
col2 int); |
| 1395 |
CREATE TABLE dump_test.test_table_nonn_chld1 ( |
| 1396 |
CONSTRAINT nn NOT NULL col2 NO INHERIT) |
| 1397 |
INHERITS (dump_test.test_table_nonn); ', |
| 1398 |
regexp => qr/^ |
| 1399 |
\QCREATE TABLE dump_test.test_table_nonn (\E \n^\s+ |
| 1400 |
\Qcol1 integer NOT NULL NO INHERIT\E |
| 1401 |
/xm, |
| 1402 |
like => { |
| 1403 |
%full_runs, %dump_test_schema_runs, |
| 1404 |
section_pre_data => 1, |
| 1405 |
binary_upgrade => 1, |
| 1406 |
}, |
| 1407 |
unlike => { |
| 1408 |
exclude_dump_test_schema => 1, |
| 1409 |
only_dump_measurement => 1, |
| 1410 |
}, |
| 1411 |
}, |
| 1412 |
|
| 1413 |
'CONSTRAINT NOT NULL / NO INHERIT (child1)' => { |
| 1414 |
regexp => qr/^ |
| 1415 |
\QCREATE TABLE dump_test.test_table_nonn_chld1 (\E \n^\s+ |
| 1416 |
\QCONSTRAINT nn NOT NULL col2 NO INHERIT\E |
| 1417 |
/xm, |
| 1418 |
like => { |
| 1419 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 1420 |
}, |
| 1421 |
unlike => { |
| 1422 |
exclude_dump_test_schema => 1, |
| 1423 |
only_dump_measurement => 1, |
| 1424 |
binary_upgrade => 1, |
| 1425 |
}, |
| 1426 |
}, |
| 1427 |
|
| 1428 |
'CONSTRAINT PRIMARY KEY / WITHOUT OVERLAPS' => { |
| 1429 |
create_sql => 'CREATE TABLE dump_test.test_table_tpk ( |
| 1430 |
col1 int4range, |
| 1431 |
col2 tstzrange, |
| 1432 |
CONSTRAINT test_table_tpk_pkey PRIMARY KEY (col1, col2 WITHOUT OVERLAPS));', |
| 1433 |
regexp => qr/^ |
| 1434 |
\QALTER TABLE ONLY dump_test.test_table_tpk\E \n^\s+ |
| 1435 |
\QADD CONSTRAINT test_table_tpk_pkey PRIMARY KEY (col1, col2 WITHOUT OVERLAPS);\E |
| 1436 |
/xm, |
| 1437 |
like => { |
| 1438 |
%full_runs, %dump_test_schema_runs, section_post_data => 1, |
| 1439 |
}, |
| 1440 |
unlike => { |
| 1441 |
exclude_dump_test_schema => 1, |
| 1442 |
only_dump_measurement => 1, |
| 1443 |
}, |
| 1444 |
}, |
| 1445 |
|
| 1446 |
'CONSTRAINT UNIQUE / WITHOUT OVERLAPS' => { |
| 1447 |
create_sql => 'CREATE TABLE dump_test.test_table_tuq ( |
| 1448 |
col1 int4range, |
| 1449 |
col2 tstzrange, |
| 1450 |
CONSTRAINT test_table_tuq_uq UNIQUE (col1, col2 WITHOUT OVERLAPS));', |
| 1451 |
regexp => qr/^ |
| 1452 |
\QALTER TABLE ONLY dump_test.test_table_tuq\E \n^\s+ |
| 1453 |
\QADD CONSTRAINT test_table_tuq_uq UNIQUE (col1, col2 WITHOUT OVERLAPS);\E |
| 1454 |
/xm, |
| 1455 |
like => { |
| 1456 |
%full_runs, %dump_test_schema_runs, section_post_data => 1, |
| 1457 |
}, |
| 1458 |
unlike => { |
| 1459 |
exclude_dump_test_schema => 1, |
| 1460 |
only_dump_measurement => 1, |
| 1461 |
}, |
| 1462 |
}, |
| 1463 |
|
| 1464 |
'ALTER TABLE (partitioned) ADD CONSTRAINT ... FOREIGN KEY' => { |
| 1465 |
create_order => 4, |
| 1466 |
create_sql => 'CREATE TABLE dump_test.test_table_fk ( |
| 1467 |
col1 int references dump_test.test_table) |
| 1468 |
PARTITION BY RANGE (col1); |
| 1469 |
CREATE TABLE dump_test.test_table_fk_1 |
| 1470 |
PARTITION OF dump_test.test_table_fk |
| 1471 |
FOR VALUES FROM (0) TO (10);', |
| 1472 |
regexp => qr/ |
| 1473 |
\QADD CONSTRAINT test_table_fk_col1_fkey FOREIGN KEY (col1) REFERENCES dump_test.test_table\E |
| 1474 |
/xm, |
| 1475 |
like => { |
| 1476 |
%full_runs, %dump_test_schema_runs, section_post_data => 1, |
| 1477 |
}, |
| 1478 |
unlike => { |
| 1479 |
exclude_dump_test_schema => 1, |
| 1480 |
only_dump_measurement => 1, |
| 1481 |
}, |
| 1482 |
}, |
| 1483 |
|
| 1484 |
'ALTER TABLE ONLY test_table ALTER COLUMN col1 SET STATISTICS 90' => { |
| 1485 |
create_order => 93, |
| 1486 |
create_sql => |
| 1487 |
'ALTER TABLE dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;', |
| 1488 |
regexp => qr/^ |
| 1489 |
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;\E\n |
| 1490 |
/xm, |
| 1491 |
like => { |
| 1492 |
%full_runs, |
| 1493 |
%dump_test_schema_runs, |
| 1494 |
only_dump_test_table => 1, |
| 1495 |
section_pre_data => 1, |
| 1496 |
}, |
| 1497 |
unlike => { |
| 1498 |
exclude_dump_test_schema => 1, |
| 1499 |
exclude_test_table => 1, |
| 1500 |
only_dump_measurement => 1, |
| 1501 |
}, |
| 1502 |
}, |
| 1503 |
|
| 1504 |
'ALTER TABLE ONLY test_table ALTER COLUMN col2 SET STORAGE' => { |
| 1505 |
create_order => 94, |
| 1506 |
create_sql => |
| 1507 |
'ALTER TABLE dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;', |
| 1508 |
regexp => qr/^ |
| 1509 |
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;\E\n |
| 1510 |
/xm, |
| 1511 |
like => { |
| 1512 |
%full_runs, |
| 1513 |
%dump_test_schema_runs, |
| 1514 |
only_dump_test_table => 1, |
| 1515 |
section_pre_data => 1, |
| 1516 |
}, |
| 1517 |
unlike => { |
| 1518 |
exclude_dump_test_schema => 1, |
| 1519 |
exclude_test_table => 1, |
| 1520 |
only_dump_measurement => 1, |
| 1521 |
}, |
| 1522 |
}, |
| 1523 |
|
| 1524 |
'ALTER TABLE ONLY test_table ALTER COLUMN col3 SET STORAGE' => { |
| 1525 |
create_order => 95, |
| 1526 |
create_sql => |
| 1527 |
'ALTER TABLE dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;', |
| 1528 |
regexp => qr/^ |
| 1529 |
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;\E\n |
| 1530 |
/xm, |
| 1531 |
like => { |
| 1532 |
%full_runs, |
| 1533 |
%dump_test_schema_runs, |
| 1534 |
only_dump_test_table => 1, |
| 1535 |
section_pre_data => 1, |
| 1536 |
}, |
| 1537 |
unlike => { |
| 1538 |
exclude_dump_test_schema => 1, |
| 1539 |
exclude_test_table => 1, |
| 1540 |
only_dump_measurement => 1, |
| 1541 |
}, |
| 1542 |
}, |
| 1543 |
|
| 1544 |
'ALTER TABLE ONLY test_table ALTER COLUMN col4 SET n_distinct' => { |
| 1545 |
create_order => 95, |
| 1546 |
create_sql => |
| 1547 |
'ALTER TABLE dump_test.test_table ALTER COLUMN col4 SET (n_distinct = 10);', |
| 1548 |
regexp => qr/^ |
| 1549 |
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col4 SET (n_distinct=10);\E\n |
| 1550 |
/xm, |
| 1551 |
like => { |
| 1552 |
%full_runs, |
| 1553 |
%dump_test_schema_runs, |
| 1554 |
only_dump_test_table => 1, |
| 1555 |
section_pre_data => 1, |
| 1556 |
}, |
| 1557 |
unlike => { |
| 1558 |
exclude_dump_test_schema => 1, |
| 1559 |
exclude_test_table => 1, |
| 1560 |
only_dump_measurement => 1, |
| 1561 |
}, |
| 1562 |
}, |
| 1563 |
|
| 1564 |
'ALTER TABLE ONLY dump_test.measurement ATTACH PARTITION measurement_y2006m2' |
| 1565 |
=> { |
| 1566 |
regexp => qr/^ |
| 1567 |
\QALTER TABLE ONLY dump_test.measurement ATTACH PARTITION dump_test_second_schema.measurement_y2006m2 \E |
| 1568 |
\QFOR VALUES FROM ('2006-02-01') TO ('2006-03-01');\E\n |
| 1569 |
/xm, |
| 1570 |
like => { |
| 1571 |
%full_runs, |
| 1572 |
role => 1, |
| 1573 |
section_pre_data => 1, |
| 1574 |
binary_upgrade => 1, |
| 1575 |
only_dump_measurement => 1, |
| 1576 |
}, |
| 1577 |
unlike => { |
| 1578 |
exclude_measurement => 1, |
| 1579 |
}, |
| 1580 |
}, |
| 1581 |
|
| 1582 |
'ALTER TABLE test_table CLUSTER ON test_table_pkey' => { |
| 1583 |
create_order => 96, |
| 1584 |
create_sql => |
| 1585 |
'ALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey', |
| 1586 |
regexp => qr/^ |
| 1587 |
\QALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey;\E\n |
| 1588 |
/xm, |
| 1589 |
like => { |
| 1590 |
%full_runs, |
| 1591 |
%dump_test_schema_runs, |
| 1592 |
only_dump_test_table => 1, |
| 1593 |
section_post_data => 1, |
| 1594 |
}, |
| 1595 |
unlike => { |
| 1596 |
exclude_dump_test_schema => 1, |
| 1597 |
exclude_test_table => 1, |
| 1598 |
only_dump_measurement => 1, |
| 1599 |
}, |
| 1600 |
}, |
| 1601 |
|
| 1602 |
'ALTER TABLE test_table DISABLE TRIGGER ALL' => { |
| 1603 |
regexp => qr/^ |
| 1604 |
\QSET SESSION AUTHORIZATION 'test_superuser';\E\n\n |
| 1605 |
\QALTER TABLE dump_test.test_table DISABLE TRIGGER ALL;\E\n\n |
| 1606 |
\QCOPY dump_test.test_table (col1, col2, col3, col4) FROM stdin;\E |
| 1607 |
\n(?:\d\t\\N\t\\N\t\\N\n){9}\\\.\n\n\n |
| 1608 |
\QALTER TABLE dump_test.test_table ENABLE TRIGGER ALL;\E/xm, |
| 1609 |
like => { data_only => 1, }, |
| 1610 |
}, |
| 1611 |
|
| 1612 |
'ALTER FOREIGN TABLE foreign_table ALTER COLUMN c1 OPTIONS' => { |
| 1613 |
regexp => qr/^ |
| 1614 |
\QALTER FOREIGN TABLE ONLY dump_test.foreign_table ALTER COLUMN c1 OPTIONS (\E\n |
| 1615 |
\s+\Qcolumn_name 'col1'\E\n |
| 1616 |
\Q);\E\n |
| 1617 |
/xm, |
| 1618 |
like => |
| 1619 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1620 |
unlike => { |
| 1621 |
exclude_dump_test_schema => 1, |
| 1622 |
only_dump_measurement => 1, |
| 1623 |
}, |
| 1624 |
}, |
| 1625 |
|
| 1626 |
'ALTER TABLE test_table OWNER TO' => { |
| 1627 |
regexp => qr/^\QALTER TABLE dump_test.test_table OWNER TO \E.+;/m, |
| 1628 |
like => { |
| 1629 |
%full_runs, |
| 1630 |
%dump_test_schema_runs, |
| 1631 |
only_dump_test_table => 1, |
| 1632 |
section_pre_data => 1, |
| 1633 |
}, |
| 1634 |
unlike => { |
| 1635 |
exclude_dump_test_schema => 1, |
| 1636 |
exclude_test_table => 1, |
| 1637 |
only_dump_measurement => 1, |
| 1638 |
no_owner => 1, |
| 1639 |
}, |
| 1640 |
}, |
| 1641 |
|
| 1642 |
'ALTER TABLE test_table ENABLE ROW LEVEL SECURITY' => { |
| 1643 |
create_order => 23, |
| 1644 |
create_sql => 'ALTER TABLE dump_test.test_table |
| 1645 |
ENABLE ROW LEVEL SECURITY;', |
| 1646 |
regexp => |
| 1647 |
qr/^\QALTER TABLE dump_test.test_table ENABLE ROW LEVEL SECURITY;\E/m, |
| 1648 |
like => { |
| 1649 |
%full_runs, |
| 1650 |
%dump_test_schema_runs, |
| 1651 |
only_dump_test_table => 1, |
| 1652 |
section_post_data => 1, |
| 1653 |
}, |
| 1654 |
unlike => { |
| 1655 |
exclude_dump_test_schema => 1, |
| 1656 |
exclude_test_table => 1, |
| 1657 |
no_policies => 1, |
| 1658 |
no_policies_restore => 1, |
| 1659 |
only_dump_measurement => 1, |
| 1660 |
}, |
| 1661 |
}, |
| 1662 |
|
| 1663 |
'ALTER TABLE test_second_table OWNER TO' => { |
| 1664 |
regexp => |
| 1665 |
qr/^\QALTER TABLE dump_test.test_second_table OWNER TO \E.+;/m, |
| 1666 |
like => |
| 1667 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1668 |
unlike => { |
| 1669 |
exclude_dump_test_schema => 1, |
| 1670 |
no_owner => 1, |
| 1671 |
only_dump_measurement => 1, |
| 1672 |
}, |
| 1673 |
}, |
| 1674 |
|
| 1675 |
'ALTER TABLE measurement OWNER TO' => { |
| 1676 |
regexp => qr/^\QALTER TABLE dump_test.measurement OWNER TO \E.+;/m, |
| 1677 |
like => { |
| 1678 |
%full_runs, |
| 1679 |
%dump_test_schema_runs, |
| 1680 |
section_pre_data => 1, |
| 1681 |
only_dump_measurement => 1, |
| 1682 |
}, |
| 1683 |
unlike => { |
| 1684 |
exclude_dump_test_schema => 1, |
| 1685 |
no_owner => 1, |
| 1686 |
exclude_measurement => 1, |
| 1687 |
}, |
| 1688 |
}, |
| 1689 |
|
| 1690 |
'ALTER TABLE measurement_y2006m2 OWNER TO' => { |
| 1691 |
regexp => |
| 1692 |
qr/^\QALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO \E.+;/m, |
| 1693 |
like => { |
| 1694 |
%full_runs, |
| 1695 |
role => 1, |
| 1696 |
section_pre_data => 1, |
| 1697 |
only_dump_measurement => 1, |
| 1698 |
}, |
| 1699 |
unlike => { |
| 1700 |
no_owner => 1, |
| 1701 |
exclude_measurement => 1, |
| 1702 |
}, |
| 1703 |
}, |
| 1704 |
|
| 1705 |
'ALTER FOREIGN TABLE foreign_table OWNER TO' => { |
| 1706 |
regexp => |
| 1707 |
qr/^\QALTER FOREIGN TABLE dump_test.foreign_table OWNER TO \E.+;/m, |
| 1708 |
like => |
| 1709 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1710 |
unlike => { |
| 1711 |
exclude_dump_test_schema => 1, |
| 1712 |
no_owner => 1, |
| 1713 |
only_dump_measurement => 1, |
| 1714 |
}, |
| 1715 |
}, |
| 1716 |
|
| 1717 |
'ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 OWNER TO' => { |
| 1718 |
regexp => |
| 1719 |
qr/^\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO \E.+;/m, |
| 1720 |
like => |
| 1721 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1722 |
unlike => { |
| 1723 |
exclude_dump_test_schema => 1, |
| 1724 |
no_owner => 1, |
| 1725 |
only_dump_measurement => 1, |
| 1726 |
}, |
| 1727 |
}, |
| 1728 |
|
| 1729 |
'ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 OWNER TO' => { |
| 1730 |
regexp => |
| 1731 |
qr/^\QALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO \E.+;/m, |
| 1732 |
like => |
| 1733 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1734 |
unlike => { |
| 1735 |
exclude_dump_test_schema => 1, |
| 1736 |
no_owner => 1, |
| 1737 |
only_dump_measurement => 1, |
| 1738 |
}, |
| 1739 |
}, |
| 1740 |
|
| 1741 |
'LO create (using lo_from_bytea)' => { |
| 1742 |
create_order => 50, |
| 1743 |
create_sql => |
| 1744 |
'SELECT pg_catalog.lo_from_bytea(0, \'\\x310a320a330a340a350a360a370a380a390a\');', |
| 1745 |
regexp => qr/^SELECT pg_catalog\.lo_create\('\d+'\);/m, |
| 1746 |
like => { |
| 1747 |
%full_runs, |
| 1748 |
column_inserts => 1, |
| 1749 |
data_only => 1, |
| 1750 |
inserts => 1, |
| 1751 |
no_schema => 1, |
| 1752 |
section_data => 1, |
| 1753 |
test_schema_plus_large_objects => 1, |
| 1754 |
}, |
| 1755 |
unlike => { |
| 1756 |
schema_only => 1, |
| 1757 |
no_large_objects => 1, |
| 1758 |
}, |
| 1759 |
}, |
| 1760 |
|
| 1761 |
'LO load (using lo_from_bytea)' => { |
| 1762 |
regexp => qr/^ |
| 1763 |
\QSELECT pg_catalog.lo_open\E \('\d+',\ \d+\);\n |
| 1764 |
\QSELECT pg_catalog.lowrite(0, \E |
| 1765 |
\Q'\x310a320a330a340a350a360a370a380a390a');\E\n |
| 1766 |
\QSELECT pg_catalog.lo_close(0);\E |
| 1767 |
/xm, |
| 1768 |
like => { |
| 1769 |
%full_runs, |
| 1770 |
column_inserts => 1, |
| 1771 |
data_only => 1, |
| 1772 |
inserts => 1, |
| 1773 |
no_schema => 1, |
| 1774 |
section_data => 1, |
| 1775 |
test_schema_plus_large_objects => 1, |
| 1776 |
}, |
| 1777 |
unlike => { |
| 1778 |
binary_upgrade => 1, |
| 1779 |
no_large_objects => 1, |
| 1780 |
schema_only => 1, |
| 1781 |
}, |
| 1782 |
}, |
| 1783 |
|
| 1784 |
'LO create (with no data)' => { |
| 1785 |
create_sql => 'SELECT pg_catalog.lo_create(0);', |
| 1786 |
regexp => qr/^ |
| 1787 |
\QSELECT pg_catalog.lo_open\E \('\d+',\ \d+\);\n |
| 1788 |
\QSELECT pg_catalog.lo_close(0);\E |
| 1789 |
/xm, |
| 1790 |
like => { |
| 1791 |
%full_runs, |
| 1792 |
column_inserts => 1, |
| 1793 |
data_only => 1, |
| 1794 |
inserts => 1, |
| 1795 |
no_schema => 1, |
| 1796 |
section_data => 1, |
| 1797 |
test_schema_plus_large_objects => 1, |
| 1798 |
}, |
| 1799 |
unlike => { |
| 1800 |
binary_upgrade => 1, |
| 1801 |
no_large_objects => 1, |
| 1802 |
schema_only => 1, |
| 1803 |
}, |
| 1804 |
}, |
| 1805 |
|
| 1806 |
'COMMENT ON DATABASE postgres' => { |
| 1807 |
regexp => qr/^COMMENT ON DATABASE postgres IS .+;/m, |
| 1808 |
|
| 1809 |
# Should appear in the same tests as "CREATE DATABASE postgres" |
| 1810 |
like => { createdb => 1, }, |
| 1811 |
}, |
| 1812 |
|
| 1813 |
'COMMENT ON EXTENSION plpgsql' => { |
| 1814 |
regexp => qr/^COMMENT ON EXTENSION plpgsql IS .+;/m, |
| 1815 |
|
| 1816 |
# this shouldn't ever get emitted anymore |
| 1817 |
like => {}, |
| 1818 |
}, |
| 1819 |
|
| 1820 |
'COMMENT ON SCHEMA public' => { |
| 1821 |
regexp => qr/^COMMENT ON SCHEMA public IS .+;/m, |
| 1822 |
# regress_public_owner emits this, due to create_sql of next test |
| 1823 |
like => { |
| 1824 |
pg_dumpall_dbprivs => 1, |
| 1825 |
pg_dumpall_exclude => 1, |
| 1826 |
}, |
| 1827 |
}, |
| 1828 |
|
| 1829 |
'COMMENT ON SCHEMA public IS NULL' => { |
| 1830 |
database => 'regress_public_owner', |
| 1831 |
create_order => 100, |
| 1832 |
create_sql => 'COMMENT ON SCHEMA public IS NULL;', |
| 1833 |
regexp => qr/^COMMENT ON SCHEMA public IS '';/m, |
| 1834 |
like => { defaults_public_owner => 1 }, |
| 1835 |
}, |
| 1836 |
|
| 1837 |
'COMMENT ON TABLE dump_test.test_table' => { |
| 1838 |
create_order => 36, |
| 1839 |
create_sql => 'COMMENT ON TABLE dump_test.test_table |
| 1840 |
IS \'comment on table\';', |
| 1841 |
regexp => |
| 1842 |
qr/^\QCOMMENT ON TABLE dump_test.test_table IS 'comment on table';\E/m, |
| 1843 |
like => { |
| 1844 |
%full_runs, |
| 1845 |
%dump_test_schema_runs, |
| 1846 |
only_dump_test_table => 1, |
| 1847 |
section_pre_data => 1, |
| 1848 |
}, |
| 1849 |
unlike => { |
| 1850 |
exclude_dump_test_schema => 1, |
| 1851 |
exclude_test_table => 1, |
| 1852 |
only_dump_measurement => 1, |
| 1853 |
}, |
| 1854 |
}, |
| 1855 |
|
| 1856 |
'COMMENT ON COLUMN dump_test.test_table.col1' => { |
| 1857 |
create_order => 36, |
| 1858 |
create_sql => 'COMMENT ON COLUMN dump_test.test_table.col1 |
| 1859 |
IS \'comment on column\';', |
| 1860 |
regexp => qr/^ |
| 1861 |
\QCOMMENT ON COLUMN dump_test.test_table.col1 IS 'comment on column';\E |
| 1862 |
/xm, |
| 1863 |
like => { |
| 1864 |
%full_runs, |
| 1865 |
%dump_test_schema_runs, |
| 1866 |
only_dump_test_table => 1, |
| 1867 |
section_pre_data => 1, |
| 1868 |
}, |
| 1869 |
unlike => { |
| 1870 |
exclude_dump_test_schema => 1, |
| 1871 |
exclude_test_table => 1, |
| 1872 |
only_dump_measurement => 1, |
| 1873 |
}, |
| 1874 |
}, |
| 1875 |
|
| 1876 |
'COMMENT ON COLUMN dump_test.composite.f1' => { |
| 1877 |
create_order => 44, |
| 1878 |
create_sql => 'COMMENT ON COLUMN dump_test.composite.f1 |
| 1879 |
IS \'comment on column of type\';', |
| 1880 |
regexp => qr/^ |
| 1881 |
\QCOMMENT ON COLUMN dump_test.composite.f1 IS 'comment on column of type';\E |
| 1882 |
/xm, |
| 1883 |
like => |
| 1884 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1885 |
unlike => { |
| 1886 |
exclude_dump_test_schema => 1, |
| 1887 |
only_dump_measurement => 1, |
| 1888 |
}, |
| 1889 |
}, |
| 1890 |
|
| 1891 |
'COMMENT ON COLUMN dump_test.test_second_table.col1' => { |
| 1892 |
create_order => 63, |
| 1893 |
create_sql => 'COMMENT ON COLUMN dump_test.test_second_table.col1 |
| 1894 |
IS \'comment on column col1\';', |
| 1895 |
regexp => qr/^ |
| 1896 |
\QCOMMENT ON COLUMN dump_test.test_second_table.col1 IS 'comment on column col1';\E |
| 1897 |
/xm, |
| 1898 |
like => |
| 1899 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1900 |
unlike => { |
| 1901 |
exclude_dump_test_schema => 1, |
| 1902 |
only_dump_measurement => 1, |
| 1903 |
}, |
| 1904 |
}, |
| 1905 |
|
| 1906 |
'COMMENT ON COLUMN dump_test.test_second_table.col2' => { |
| 1907 |
create_order => 64, |
| 1908 |
create_sql => 'COMMENT ON COLUMN dump_test.test_second_table.col2 |
| 1909 |
IS \'comment on column col2\';', |
| 1910 |
regexp => qr/^ |
| 1911 |
\QCOMMENT ON COLUMN dump_test.test_second_table.col2 IS 'comment on column col2';\E |
| 1912 |
/xm, |
| 1913 |
like => |
| 1914 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1915 |
unlike => { |
| 1916 |
exclude_dump_test_schema => 1, |
| 1917 |
only_dump_measurement => 1, |
| 1918 |
}, |
| 1919 |
}, |
| 1920 |
|
| 1921 |
'COMMENT ON CONVERSION dump_test.test_conversion' => { |
| 1922 |
create_order => 79, |
| 1923 |
create_sql => 'COMMENT ON CONVERSION dump_test.test_conversion |
| 1924 |
IS \'comment on test conversion\';', |
| 1925 |
regexp => |
| 1926 |
qr/^\QCOMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversion';\E/m, |
| 1927 |
like => |
| 1928 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 1929 |
unlike => { |
| 1930 |
exclude_dump_test_schema => 1, |
| 1931 |
only_dump_measurement => 1, |
| 1932 |
}, |
| 1933 |
}, |
| 1934 |
|
| 1935 |
'COMMENT ON COLLATION test0' => { |
| 1936 |
create_order => 77, |
| 1937 |
create_sql => 'COMMENT ON COLLATION test0 |
| 1938 |
IS \'comment on test0 collation\';', |
| 1939 |
regexp => |
| 1940 |
qr/^\QCOMMENT ON COLLATION public.test0 IS 'comment on test0 collation';\E/m, |
| 1941 |
collation => 1, |
| 1942 |
like => { %full_runs, section_pre_data => 1, }, |
| 1943 |
}, |
| 1944 |
|
| 1945 |
'COMMENT ON LARGE OBJECT ...' => { |
| 1946 |
create_order => 65, |
| 1947 |
create_sql => 'DO $$ |
| 1948 |
DECLARE myoid oid; |
| 1949 |
BEGIN |
| 1950 |
SELECT loid FROM pg_largeobject INTO myoid; |
| 1951 |
EXECUTE \'COMMENT ON LARGE OBJECT \' || myoid || \' IS \'\'comment on large object\'\';\'; |
| 1952 |
END; |
| 1953 |
$$;', |
| 1954 |
regexp => qr/^ |
| 1955 |
\QCOMMENT ON LARGE OBJECT \E[0-9]+\Q IS 'comment on large object';\E |
| 1956 |
/xm, |
| 1957 |
like => { |
| 1958 |
%full_runs, |
| 1959 |
column_inserts => 1, |
| 1960 |
data_only => 1, |
| 1961 |
inserts => 1, |
| 1962 |
no_schema => 1, |
| 1963 |
section_data => 1, |
| 1964 |
test_schema_plus_large_objects => 1, |
| 1965 |
}, |
| 1966 |
unlike => { |
| 1967 |
no_large_objects => 1, |
| 1968 |
schema_only => 1, |
| 1969 |
}, |
| 1970 |
}, |
| 1971 |
|
| 1972 |
'COMMENT ON POLICY p1' => { |
| 1973 |
create_order => 55, |
| 1974 |
create_sql => 'COMMENT ON POLICY p1 ON dump_test.test_table |
| 1975 |
IS \'comment on policy\';', |
| 1976 |
regexp => |
| 1977 |
qr/^COMMENT ON POLICY p1 ON dump_test.test_table IS 'comment on policy';/m, |
| 1978 |
like => { |
| 1979 |
%full_runs, |
| 1980 |
%dump_test_schema_runs, |
| 1981 |
only_dump_test_table => 1, |
| 1982 |
section_post_data => 1, |
| 1983 |
}, |
| 1984 |
unlike => { |
| 1985 |
exclude_dump_test_schema => 1, |
| 1986 |
exclude_test_table => 1, |
| 1987 |
no_policies => 1, |
| 1988 |
no_policies_restore => 1, |
| 1989 |
only_dump_measurement => 1, |
| 1990 |
}, |
| 1991 |
}, |
| 1992 |
|
| 1993 |
'COMMENT ON PUBLICATION pub1' => { |
| 1994 |
create_order => 55, |
| 1995 |
create_sql => 'COMMENT ON PUBLICATION pub1 |
| 1996 |
IS \'comment on publication\';', |
| 1997 |
regexp => |
| 1998 |
qr/^COMMENT ON PUBLICATION pub1 IS 'comment on publication';/m, |
| 1999 |
like => { %full_runs, section_post_data => 1, }, |
| 2000 |
}, |
| 2001 |
|
| 2002 |
'COMMENT ON SUBSCRIPTION sub1' => { |
| 2003 |
create_order => 55, |
| 2004 |
create_sql => 'COMMENT ON SUBSCRIPTION sub1 |
| 2005 |
IS \'comment on subscription\';', |
| 2006 |
regexp => |
| 2007 |
qr/^COMMENT ON SUBSCRIPTION sub1 IS 'comment on subscription';/m, |
| 2008 |
like => { %full_runs, section_post_data => 1, }, |
| 2009 |
unlike => { |
| 2010 |
no_subscriptions => 1, |
| 2011 |
no_subscriptions_restore => 1, |
| 2012 |
}, |
| 2013 |
}, |
| 2014 |
|
| 2015 |
'COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1' => { |
| 2016 |
create_order => 84, |
| 2017 |
create_sql => |
| 2018 |
'COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 |
| 2019 |
IS \'comment on text search configuration\';', |
| 2020 |
regexp => |
| 2021 |
qr/^\QCOMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 IS 'comment on text search configuration';\E/m, |
| 2022 |
like => |
| 2023 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2024 |
unlike => { |
| 2025 |
exclude_dump_test_schema => 1, |
| 2026 |
only_dump_measurement => 1, |
| 2027 |
}, |
| 2028 |
}, |
| 2029 |
|
| 2030 |
'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => { |
| 2031 |
create_order => 84, |
| 2032 |
create_sql => |
| 2033 |
'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 |
| 2034 |
IS \'comment on text search dictionary\';', |
| 2035 |
regexp => |
| 2036 |
qr/^\QCOMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 IS 'comment on text search dictionary';\E/m, |
| 2037 |
like => |
| 2038 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2039 |
unlike => { |
| 2040 |
exclude_dump_test_schema => 1, |
| 2041 |
only_dump_measurement => 1, |
| 2042 |
}, |
| 2043 |
}, |
| 2044 |
|
| 2045 |
'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1' => { |
| 2046 |
create_order => 84, |
| 2047 |
create_sql => 'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 |
| 2048 |
IS \'comment on text search parser\';', |
| 2049 |
regexp => |
| 2050 |
qr/^\QCOMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 IS 'comment on text search parser';\E/m, |
| 2051 |
like => |
| 2052 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2053 |
unlike => { |
| 2054 |
exclude_dump_test_schema => 1, |
| 2055 |
only_dump_measurement => 1, |
| 2056 |
}, |
| 2057 |
}, |
| 2058 |
|
| 2059 |
'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => { |
| 2060 |
create_order => 84, |
| 2061 |
create_sql => 'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 |
| 2062 |
IS \'comment on text search template\';', |
| 2063 |
regexp => |
| 2064 |
qr/^\QCOMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text search template';\E/m, |
| 2065 |
like => |
| 2066 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2067 |
unlike => { |
| 2068 |
exclude_dump_test_schema => 1, |
| 2069 |
only_dump_measurement => 1, |
| 2070 |
}, |
| 2071 |
}, |
| 2072 |
|
| 2073 |
'COMMENT ON TYPE dump_test.planets - ENUM' => { |
| 2074 |
create_order => 68, |
| 2075 |
create_sql => 'COMMENT ON TYPE dump_test.planets |
| 2076 |
IS \'comment on enum type\';', |
| 2077 |
regexp => |
| 2078 |
qr/^\QCOMMENT ON TYPE dump_test.planets IS 'comment on enum type';\E/m, |
| 2079 |
like => |
| 2080 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2081 |
unlike => { |
| 2082 |
exclude_dump_test_schema => 1, |
| 2083 |
only_dump_measurement => 1, |
| 2084 |
}, |
| 2085 |
}, |
| 2086 |
|
| 2087 |
'COMMENT ON TYPE dump_test.textrange - RANGE' => { |
| 2088 |
create_order => 69, |
| 2089 |
create_sql => 'COMMENT ON TYPE dump_test.textrange |
| 2090 |
IS \'comment on range type\';', |
| 2091 |
regexp => |
| 2092 |
qr/^\QCOMMENT ON TYPE dump_test.textrange IS 'comment on range type';\E/m, |
| 2093 |
like => |
| 2094 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2095 |
unlike => { |
| 2096 |
exclude_dump_test_schema => 1, |
| 2097 |
only_dump_measurement => 1, |
| 2098 |
}, |
| 2099 |
}, |
| 2100 |
|
| 2101 |
'COMMENT ON TYPE dump_test.int42 - Regular' => { |
| 2102 |
create_order => 70, |
| 2103 |
create_sql => 'COMMENT ON TYPE dump_test.int42 |
| 2104 |
IS \'comment on regular type\';', |
| 2105 |
regexp => |
| 2106 |
qr/^\QCOMMENT ON TYPE dump_test.int42 IS 'comment on regular type';\E/m, |
| 2107 |
like => |
| 2108 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2109 |
unlike => { |
| 2110 |
exclude_dump_test_schema => 1, |
| 2111 |
only_dump_measurement => 1, |
| 2112 |
}, |
| 2113 |
}, |
| 2114 |
|
| 2115 |
'COMMENT ON TYPE dump_test.undefined - Undefined' => { |
| 2116 |
create_order => 71, |
| 2117 |
create_sql => 'COMMENT ON TYPE dump_test.undefined |
| 2118 |
IS \'comment on undefined type\';', |
| 2119 |
regexp => |
| 2120 |
qr/^\QCOMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';\E/m, |
| 2121 |
like => |
| 2122 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2123 |
unlike => { |
| 2124 |
exclude_dump_test_schema => 1, |
| 2125 |
only_dump_measurement => 1, |
| 2126 |
}, |
| 2127 |
}, |
| 2128 |
|
| 2129 |
'COPY test_table' => { |
| 2130 |
create_order => 4, |
| 2131 |
create_sql => 'INSERT INTO dump_test.test_table (col1) ' |
| 2132 |
. 'SELECT generate_series FROM generate_series(1,9);', |
| 2133 |
regexp => qr/^ |
| 2134 |
\QCOPY dump_test.test_table (col1, col2, col3, col4) FROM stdin;\E |
| 2135 |
\n(?:\d\t\\N\t\\N\t\\N\n){9}\\\.\n |
| 2136 |
/xm, |
| 2137 |
like => { |
| 2138 |
%full_runs, |
| 2139 |
%dump_test_schema_runs, |
| 2140 |
data_only => 1, |
| 2141 |
no_schema => 1, |
| 2142 |
only_dump_test_table => 1, |
| 2143 |
section_data => 1, |
| 2144 |
}, |
| 2145 |
unlike => { |
| 2146 |
binary_upgrade => 1, |
| 2147 |
exclude_dump_test_schema => 1, |
| 2148 |
exclude_test_table => 1, |
| 2149 |
exclude_test_table_data => 1, |
| 2150 |
schema_only => 1, |
| 2151 |
only_dump_measurement => 1, |
| 2152 |
}, |
| 2153 |
}, |
| 2154 |
|
| 2155 |
'COPY fk_reference_test_table' => { |
| 2156 |
create_order => 22, |
| 2157 |
create_sql => 'INSERT INTO dump_test.fk_reference_test_table (col1) ' |
| 2158 |
. 'SELECT generate_series FROM generate_series(1,5);', |
| 2159 |
regexp => qr/^ |
| 2160 |
\QCOPY dump_test.fk_reference_test_table (col1) FROM stdin;\E |
| 2161 |
\n(?:\d\n){5}\\\.\n |
| 2162 |
/xm, |
| 2163 |
like => { |
| 2164 |
%full_runs, |
| 2165 |
%dump_test_schema_runs, |
| 2166 |
data_only => 1, |
| 2167 |
exclude_test_table => 1, |
| 2168 |
exclude_test_table_data => 1, |
| 2169 |
no_schema => 1, |
| 2170 |
section_data => 1, |
| 2171 |
}, |
| 2172 |
unlike => { |
| 2173 |
binary_upgrade => 1, |
| 2174 |
exclude_dump_test_schema => 1, |
| 2175 |
schema_only => 1, |
| 2176 |
only_dump_measurement => 1, |
| 2177 |
}, |
| 2178 |
}, |
| 2179 |
|
| 2180 |
# In a data-only dump, we try to actually order according to FKs, |
| 2181 |
# so this check is just making sure that the referring table comes after |
| 2182 |
# the referred-to table. |
| 2183 |
'COPY fk_reference_test_table second' => { |
| 2184 |
regexp => qr/^ |
| 2185 |
\QCOPY dump_test.test_table (col1, col2, col3, col4) FROM stdin;\E |
| 2186 |
\n(?:\d\t\\N\t\\N\t\\N\n){9}\\\.\n.* |
| 2187 |
\QCOPY dump_test.fk_reference_test_table (col1) FROM stdin;\E |
| 2188 |
\n(?:\d\n){5}\\\.\n |
| 2189 |
/xms, |
| 2190 |
like => { |
| 2191 |
data_only => 1, |
| 2192 |
no_schema => 1, |
| 2193 |
}, |
| 2194 |
}, |
| 2195 |
|
| 2196 |
'COPY test_second_table' => { |
| 2197 |
create_order => 7, |
| 2198 |
create_sql => 'INSERT INTO dump_test.test_second_table (col1, col2) ' |
| 2199 |
. 'SELECT generate_series, generate_series::text ' |
| 2200 |
. 'FROM generate_series(1,9);', |
| 2201 |
regexp => qr/^ |
| 2202 |
\QCOPY dump_test.test_second_table (col1, col2) FROM stdin;\E |
| 2203 |
\n(?:\d\t\d\n){9}\\\.\n |
| 2204 |
/xm, |
| 2205 |
like => { |
| 2206 |
%full_runs, |
| 2207 |
%dump_test_schema_runs, |
| 2208 |
data_only => 1, |
| 2209 |
no_schema => 1, |
| 2210 |
section_data => 1, |
| 2211 |
}, |
| 2212 |
unlike => { |
| 2213 |
binary_upgrade => 1, |
| 2214 |
exclude_dump_test_schema => 1, |
| 2215 |
schema_only => 1, |
| 2216 |
only_dump_measurement => 1, |
| 2217 |
}, |
| 2218 |
}, |
| 2219 |
|
| 2220 |
'COPY test_third_table' => { |
| 2221 |
create_order => 7, |
| 2222 |
create_sql => |
| 2223 |
'INSERT INTO dump_test.test_third_table VALUES (123, DEFAULT, 456);', |
| 2224 |
regexp => qr/^ |
| 2225 |
\QCOPY dump_test.test_third_table (f1, "F3") FROM stdin;\E |
| 2226 |
\n123\t456\n\\\.\n |
| 2227 |
/xm, |
| 2228 |
like => { |
| 2229 |
%full_runs, |
| 2230 |
%dump_test_schema_runs, |
| 2231 |
data_only => 1, |
| 2232 |
no_schema => 1, |
| 2233 |
section_data => 1, |
| 2234 |
}, |
| 2235 |
unlike => { |
| 2236 |
binary_upgrade => 1, |
| 2237 |
exclude_dump_test_schema => 1, |
| 2238 |
schema_only => 1, |
| 2239 |
only_dump_measurement => 1, |
| 2240 |
}, |
| 2241 |
}, |
| 2242 |
|
| 2243 |
'COPY test_fourth_table' => { |
| 2244 |
create_order => 7, |
| 2245 |
create_sql => |
| 2246 |
'INSERT INTO dump_test.test_fourth_table DEFAULT VALUES;' |
| 2247 |
. 'INSERT INTO dump_test.test_fourth_table DEFAULT VALUES;', |
| 2248 |
regexp => qr/^ |
| 2249 |
\QCOPY dump_test.test_fourth_table FROM stdin;\E |
| 2250 |
\n\n\n\\\.\n |
| 2251 |
/xm, |
| 2252 |
like => { |
| 2253 |
%full_runs, |
| 2254 |
%dump_test_schema_runs, |
| 2255 |
data_only => 1, |
| 2256 |
no_schema => 1, |
| 2257 |
section_data => 1, |
| 2258 |
}, |
| 2259 |
unlike => { |
| 2260 |
binary_upgrade => 1, |
| 2261 |
exclude_dump_test_schema => 1, |
| 2262 |
schema_only => 1, |
| 2263 |
only_dump_measurement => 1, |
| 2264 |
}, |
| 2265 |
}, |
| 2266 |
|
| 2267 |
'COPY test_fifth_table' => { |
| 2268 |
create_order => 54, |
| 2269 |
create_sql => |
| 2270 |
'INSERT INTO dump_test.test_fifth_table VALUES (NULL, true, false, \'11001\'::bit(5), \'NaN\');', |
| 2271 |
regexp => qr/^ |
| 2272 |
\QCOPY dump_test.test_fifth_table (col1, col2, col3, col4, col5) FROM stdin;\E |
| 2273 |
\n\\N\tt\tf\t11001\tNaN\n\\\.\n |
| 2274 |
/xm, |
| 2275 |
like => { |
| 2276 |
%full_runs, |
| 2277 |
%dump_test_schema_runs, |
| 2278 |
data_only => 1, |
| 2279 |
no_schema => 1, |
| 2280 |
section_data => 1, |
| 2281 |
}, |
| 2282 |
unlike => { |
| 2283 |
binary_upgrade => 1, |
| 2284 |
exclude_dump_test_schema => 1, |
| 2285 |
schema_only => 1, |
| 2286 |
only_dump_measurement => 1, |
| 2287 |
}, |
| 2288 |
}, |
| 2289 |
|
| 2290 |
'COPY test_table_identity' => { |
| 2291 |
create_order => 54, |
| 2292 |
create_sql => |
| 2293 |
'INSERT INTO dump_test.test_table_identity (col2) VALUES (\'test\');', |
| 2294 |
regexp => qr/^ |
| 2295 |
\QCOPY dump_test.test_table_identity (col1, col2) FROM stdin;\E |
| 2296 |
\n1\ttest\n\\\.\n |
| 2297 |
/xm, |
| 2298 |
like => { |
| 2299 |
%full_runs, |
| 2300 |
%dump_test_schema_runs, |
| 2301 |
data_only => 1, |
| 2302 |
no_schema => 1, |
| 2303 |
section_data => 1, |
| 2304 |
}, |
| 2305 |
unlike => { |
| 2306 |
binary_upgrade => 1, |
| 2307 |
exclude_dump_test_schema => 1, |
| 2308 |
schema_only => 1, |
| 2309 |
only_dump_measurement => 1, |
| 2310 |
}, |
| 2311 |
}, |
| 2312 |
|
| 2313 |
'INSERT INTO test_table' => { |
| 2314 |
regexp => qr/^ |
| 2315 |
(?:INSERT\ INTO\ dump_test\.test_table\ \(col1,\ col2,\ col3,\ col4\)\ VALUES\ \(\d,\ NULL,\ NULL,\ NULL\);\n){9} |
| 2316 |
/xm, |
| 2317 |
like => { column_inserts => 1, }, |
| 2318 |
}, |
| 2319 |
|
| 2320 |
'test_table with 4-row INSERTs' => { |
| 2321 |
regexp => qr/^ |
| 2322 |
(?: |
| 2323 |
INSERT\ INTO\ dump_test\.test_table\ VALUES\n |
| 2324 |
(?:\t\(\d,\ NULL,\ NULL,\ NULL\),\n){3} |
| 2325 |
\t\(\d,\ NULL,\ NULL,\ NULL\);\n |
| 2326 |
){2} |
| 2327 |
INSERT\ INTO\ dump_test\.test_table\ VALUES\n |
| 2328 |
\t\(\d,\ NULL,\ NULL,\ NULL\); |
| 2329 |
/xm, |
| 2330 |
like => { rows_per_insert => 1, }, |
| 2331 |
}, |
| 2332 |
|
| 2333 |
'INSERT INTO test_second_table' => { |
| 2334 |
regexp => qr/^ |
| 2335 |
(?:INSERT\ INTO\ dump_test\.test_second_table\ \(col1,\ col2\) |
| 2336 |
\ VALUES\ \(\d,\ '\d'\);\n){9}/xm, |
| 2337 |
like => { column_inserts => 1, }, |
| 2338 |
}, |
| 2339 |
|
| 2340 |
'INSERT INTO test_third_table (colnames)' => { |
| 2341 |
regexp => |
| 2342 |
qr/^INSERT INTO dump_test\.test_third_table \(f1, "F3"\) VALUES \(123, 456\);\n/m, |
| 2343 |
like => { column_inserts => 1, }, |
| 2344 |
}, |
| 2345 |
|
| 2346 |
'INSERT INTO test_third_table' => { |
| 2347 |
regexp => |
| 2348 |
qr/^INSERT INTO dump_test\.test_third_table VALUES \(123, DEFAULT, 456, DEFAULT\);\n/m, |
| 2349 |
like => { inserts => 1, }, |
| 2350 |
}, |
| 2351 |
|
| 2352 |
'INSERT INTO test_fourth_table' => { |
| 2353 |
regexp => |
| 2354 |
qr/^(?:INSERT INTO dump_test\.test_fourth_table DEFAULT VALUES;\n){2}/m, |
| 2355 |
like => { column_inserts => 1, inserts => 1, rows_per_insert => 1, }, |
| 2356 |
}, |
| 2357 |
|
| 2358 |
'INSERT INTO test_fifth_table' => { |
| 2359 |
regexp => |
| 2360 |
qr/^\QINSERT INTO dump_test.test_fifth_table (col1, col2, col3, col4, col5) VALUES (NULL, true, false, B'11001', 'NaN');\E/m, |
| 2361 |
like => { column_inserts => 1, }, |
| 2362 |
}, |
| 2363 |
|
| 2364 |
'INSERT INTO test_table_identity' => { |
| 2365 |
regexp => |
| 2366 |
qr/^\QINSERT INTO dump_test.test_table_identity (col1, col2) OVERRIDING SYSTEM VALUE VALUES (1, 'test');\E/m, |
| 2367 |
like => { column_inserts => 1, }, |
| 2368 |
}, |
| 2369 |
|
| 2370 |
'CREATE ROLE regress_dump_test_role' => { |
| 2371 |
create_order => 1, |
| 2372 |
create_sql => 'CREATE ROLE regress_dump_test_role;', |
| 2373 |
regexp => qr/^CREATE ROLE regress_dump_test_role;/m, |
| 2374 |
like => { |
| 2375 |
pg_dumpall_dbprivs => 1, |
| 2376 |
pg_dumpall_exclude => 1, |
| 2377 |
pg_dumpall_globals => 1, |
| 2378 |
pg_dumpall_globals_clean => 1, |
| 2379 |
}, |
| 2380 |
}, |
| 2381 |
|
| 2382 |
'CREATE ROLE regress_quoted...' => { |
| 2383 |
create_order => 1, |
| 2384 |
create_sql => 'CREATE ROLE "regress_quoted \"" role";', |
| 2385 |
regexp => qr/^CREATE ROLE "regress_quoted \\"" role";/m, |
| 2386 |
like => { |
| 2387 |
pg_dumpall_dbprivs => 1, |
| 2388 |
pg_dumpall_exclude => 1, |
| 2389 |
pg_dumpall_globals => 1, |
| 2390 |
pg_dumpall_globals_clean => 1, |
| 2391 |
}, |
| 2392 |
}, |
| 2393 |
|
| 2394 |
'newline of role or table name in comment' => { |
| 2395 |
create_sql => qq{CREATE ROLE regress_newline; |
| 2396 |
ALTER ROLE regress_newline SET enable_seqscan = off; |
| 2397 |
ALTER ROLE regress_newline |
| 2398 |
RENAME TO "regress_newline\nattack"; |
| 2399 |
|
| 2400 |
-- meet getPartitioningInfo() "unsafe" condition |
| 2401 |
CREATE TYPE pp_colors AS |
| 2402 |
ENUM ('green', 'blue', 'black'); |
| 2403 |
CREATE TABLE pp_enumpart (a pp_colors) |
| 2404 |
PARTITION BY HASH (a); |
| 2405 |
CREATE TABLE pp_enumpart1 PARTITION OF pp_enumpart |
| 2406 |
FOR VALUES WITH (MODULUS 2, REMAINDER 0); |
| 2407 |
CREATE TABLE pp_enumpart2 PARTITION OF pp_enumpart |
| 2408 |
FOR VALUES WITH (MODULUS 2, REMAINDER 1); |
| 2409 |
ALTER TABLE pp_enumpart |
| 2410 |
RENAME TO "pp_enumpart\nattack";}, |
| 2411 |
regexp => qr/\n--[^\n]*\nattack/s, |
| 2412 |
like => {}, |
| 2413 |
}, |
| 2414 |
|
| 2415 |
'CREATE TABLESPACE regress_dump_tablespace' => { |
| 2416 |
create_order => 2, |
| 2417 |
create_sql => q( |
| 2418 |
SET allow_in_place_tablespaces = on; |
| 2419 |
CREATE TABLESPACE regress_dump_tablespace |
| 2420 |
OWNER regress_dump_test_role LOCATION ''), |
| 2421 |
regexp => |
| 2422 |
qr/^CREATE TABLESPACE regress_dump_tablespace OWNER regress_dump_test_role LOCATION '';/m, |
| 2423 |
like => { |
| 2424 |
pg_dumpall_dbprivs => 1, |
| 2425 |
pg_dumpall_exclude => 1, |
| 2426 |
pg_dumpall_globals => 1, |
| 2427 |
pg_dumpall_globals_clean => 1, |
| 2428 |
}, |
| 2429 |
}, |
| 2430 |
|
| 2431 |
'CREATE DATABASE regression_invalid...' => { |
| 2432 |
create_order => 1, |
| 2433 |
create_sql => q( |
| 2434 |
CREATE DATABASE regression_invalid; |
| 2435 |
UPDATE pg_database SET datconnlimit = -2 WHERE datname = 'regression_invalid'), |
| 2436 |
regexp => qr/^CREATE DATABASE regression_invalid/m, |
| 2437 |
|
| 2438 |
# invalid databases should never be dumped |
| 2439 |
like => {}, |
| 2440 |
}, |
| 2441 |
|
| 2442 |
'CREATE ACCESS METHOD gist2' => { |
| 2443 |
create_order => 52, |
| 2444 |
create_sql => |
| 2445 |
'CREATE ACCESS METHOD gist2 TYPE INDEX HANDLER gisthandler;', |
| 2446 |
regexp => |
| 2447 |
qr/CREATE ACCESS METHOD gist2 TYPE INDEX HANDLER gisthandler;/m, |
| 2448 |
like => { %full_runs, section_pre_data => 1, }, |
| 2449 |
}, |
| 2450 |
|
| 2451 |
'CREATE COLLATION test0 FROM "C"' => { |
| 2452 |
create_order => 76, |
| 2453 |
create_sql => 'CREATE COLLATION test0 FROM "C";', |
| 2454 |
regexp => |
| 2455 |
qr/CREATE COLLATION public.test0 \(provider = libc, locale = 'C'(, version = '[^']*')?\);/m, |
| 2456 |
collation => 1, |
| 2457 |
like => { %full_runs, section_pre_data => 1, }, |
| 2458 |
}, |
| 2459 |
|
| 2460 |
'CREATE COLLATION icu_collation' => { |
| 2461 |
create_order => 76, |
| 2462 |
create_sql => |
| 2463 |
"CREATE COLLATION icu_collation (PROVIDER = icu, LOCALE = 'en-US-u-va-posix');", |
| 2464 |
regexp => |
| 2465 |
qr/CREATE COLLATION public.icu_collation \(provider = icu, locale = 'en-US-u-va-posix'(, version = '[^']*')?\);/m, |
| 2466 |
icu => 1, |
| 2467 |
like => { %full_runs, section_pre_data => 1, }, |
| 2468 |
}, |
| 2469 |
|
| 2470 |
'CREATE CAST FOR timestamptz' => { |
| 2471 |
create_order => 51, |
| 2472 |
create_sql => |
| 2473 |
'CREATE CAST (timestamptz AS interval) WITH FUNCTION age(timestamptz) AS ASSIGNMENT;', |
| 2474 |
regexp => |
| 2475 |
qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog\.age\(timestamp with time zone\) AS ASSIGNMENT;/m, |
| 2476 |
like => { %full_runs, section_pre_data => 1, }, |
| 2477 |
}, |
| 2478 |
|
| 2479 |
'CREATE DATABASE postgres' => { |
| 2480 |
regexp => qr/^ |
| 2481 |
\QCREATE DATABASE postgres WITH TEMPLATE = template0 \E |
| 2482 |
.+;/xm, |
| 2483 |
like => { createdb => 1, }, |
| 2484 |
}, |
| 2485 |
|
| 2486 |
'CREATE DATABASE dump_test' => { |
| 2487 |
create_order => 47, |
| 2488 |
create_sql => 'CREATE DATABASE dump_test;', |
| 2489 |
regexp => qr/^ |
| 2490 |
\QCREATE DATABASE dump_test WITH TEMPLATE = template0 \E |
| 2491 |
.+;/xm, |
| 2492 |
like => { pg_dumpall_dbprivs => 1, }, |
| 2493 |
}, |
| 2494 |
|
| 2495 |
"CREATE DATABASE dump_test2 LOCALE = 'C'" => { |
| 2496 |
create_order => 47, |
| 2497 |
create_sql => |
| 2498 |
"CREATE DATABASE dump_test2 LOCALE = 'C' TEMPLATE = template0;", |
| 2499 |
regexp => qr/^ |
| 2500 |
\QCREATE DATABASE dump_test2 \E.*\QLOCALE = 'C';\E |
| 2501 |
/xm, |
| 2502 |
like => { pg_dumpall_dbprivs => 1, }, |
| 2503 |
}, |
| 2504 |
|
| 2505 |
'CREATE EXTENSION ... plpgsql' => { |
| 2506 |
regexp => qr/^ |
| 2507 |
\QCREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;\E |
| 2508 |
/xm, |
| 2509 |
|
| 2510 |
# this shouldn't ever get emitted anymore |
| 2511 |
like => {}, |
| 2512 |
}, |
| 2513 |
|
| 2514 |
'CREATE AGGREGATE dump_test.newavg' => { |
| 2515 |
create_order => 25, |
| 2516 |
create_sql => 'CREATE AGGREGATE dump_test.newavg ( |
| 2517 |
sfunc = int4_avg_accum, |
| 2518 |
basetype = int4, |
| 2519 |
stype = _int8, |
| 2520 |
finalfunc = int8_avg, |
| 2521 |
finalfunc_modify = shareable, |
| 2522 |
initcond1 = \'{0,0}\' |
| 2523 |
);', |
| 2524 |
regexp => qr/^ |
| 2525 |
\QCREATE AGGREGATE dump_test.newavg(integer) (\E |
| 2526 |
\n\s+\QSFUNC = int4_avg_accum,\E |
| 2527 |
\n\s+\QSTYPE = bigint[],\E |
| 2528 |
\n\s+\QINITCOND = '{0,0}',\E |
| 2529 |
\n\s+\QFINALFUNC = int8_avg,\E |
| 2530 |
\n\s+\QFINALFUNC_MODIFY = SHAREABLE\E |
| 2531 |
\n\);/xm, |
| 2532 |
like => { |
| 2533 |
%full_runs, |
| 2534 |
%dump_test_schema_runs, |
| 2535 |
exclude_test_table => 1, |
| 2536 |
section_pre_data => 1, |
| 2537 |
}, |
| 2538 |
unlike => { |
| 2539 |
exclude_dump_test_schema => 1, |
| 2540 |
only_dump_measurement => 1, |
| 2541 |
}, |
| 2542 |
}, |
| 2543 |
|
| 2544 |
'CREATE CONVERSION dump_test.test_conversion' => { |
| 2545 |
create_order => 78, |
| 2546 |
create_sql => |
| 2547 |
'CREATE DEFAULT CONVERSION dump_test.test_conversion FOR \'LATIN1\' TO \'UTF8\' FROM iso8859_1_to_utf8;', |
| 2548 |
regexp => |
| 2549 |
qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;\E/xm, |
| 2550 |
like => |
| 2551 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2552 |
unlike => { |
| 2553 |
exclude_dump_test_schema => 1, |
| 2554 |
only_dump_measurement => 1, |
| 2555 |
}, |
| 2556 |
}, |
| 2557 |
|
| 2558 |
'CREATE DOMAIN dump_test.us_postal_code' => { |
| 2559 |
create_order => 29, |
| 2560 |
create_sql => 'CREATE DOMAIN dump_test.us_postal_code AS TEXT |
| 2561 |
COLLATE "C" |
| 2562 |
DEFAULT \'10014\' |
| 2563 |
CONSTRAINT nn NOT NULL |
| 2564 |
CHECK(VALUE ~ \'^\d{5}$\' OR |
| 2565 |
VALUE ~ \'^\d{5}-\d{4}$\'); |
| 2566 |
COMMENT ON CONSTRAINT nn |
| 2567 |
ON DOMAIN dump_test.us_postal_code IS \'not null\'; |
| 2568 |
COMMENT ON CONSTRAINT us_postal_code_check |
| 2569 |
ON DOMAIN dump_test.us_postal_code IS \'check it\';', |
| 2570 |
regexp => qr/^ |
| 2571 |
\QCREATE DOMAIN dump_test.us_postal_code AS text COLLATE pg_catalog."C" CONSTRAINT nn NOT NULL DEFAULT '10014'::text\E\n\s+ |
| 2572 |
\QCONSTRAINT us_postal_code_check CHECK \E |
| 2573 |
\Q(((VALUE ~ '^\d{5}\E |
| 2574 |
\$\Q'::text) OR (VALUE ~ '^\d{5}-\d{4}\E\$ |
| 2575 |
\Q'::text)));\E(.|\n)* |
| 2576 |
/xm, |
| 2577 |
like => |
| 2578 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2579 |
unlike => { |
| 2580 |
exclude_dump_test_schema => 1, |
| 2581 |
only_dump_measurement => 1, |
| 2582 |
}, |
| 2583 |
}, |
| 2584 |
|
| 2585 |
'COMMENT ON CONSTRAINT ON DOMAIN (1)' => { |
| 2586 |
regexp => qr/^ |
| 2587 |
\QCOMMENT ON CONSTRAINT nn ON DOMAIN dump_test.us_postal_code IS 'not null';\E |
| 2588 |
/xm, |
| 2589 |
like => |
| 2590 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2591 |
unlike => { |
| 2592 |
exclude_dump_test_schema => 1, |
| 2593 |
only_dump_measurement => 1, |
| 2594 |
}, |
| 2595 |
}, |
| 2596 |
|
| 2597 |
'COMMENT ON CONSTRAINT ON DOMAIN (2)' => { |
| 2598 |
regexp => qr/^ |
| 2599 |
\QCOMMENT ON CONSTRAINT us_postal_code_check ON DOMAIN dump_test.us_postal_code IS 'check it';\E |
| 2600 |
/xm, |
| 2601 |
like => |
| 2602 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2603 |
unlike => { |
| 2604 |
exclude_dump_test_schema => 1, |
| 2605 |
only_dump_measurement => 1, |
| 2606 |
}, |
| 2607 |
}, |
| 2608 |
|
| 2609 |
'CREATE FUNCTION dump_test.pltestlang_call_handler' => { |
| 2610 |
create_order => 17, |
| 2611 |
create_sql => 'CREATE FUNCTION dump_test.pltestlang_call_handler() |
| 2612 |
RETURNS LANGUAGE_HANDLER AS \'$libdir/plpgsql\', |
| 2613 |
\'plpgsql_call_handler\' LANGUAGE C;', |
| 2614 |
regexp => qr/^ |
| 2615 |
\QCREATE FUNCTION dump_test.pltestlang_call_handler() \E |
| 2616 |
\QRETURNS language_handler\E |
| 2617 |
\n\s+\QLANGUAGE c\E |
| 2618 |
\n\s+AS\ \'\$ |
| 2619 |
\Qlibdir\/plpgsql', 'plpgsql_call_handler';\E |
| 2620 |
/xm, |
| 2621 |
like => |
| 2622 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2623 |
unlike => { |
| 2624 |
exclude_dump_test_schema => 1, |
| 2625 |
only_dump_measurement => 1, |
| 2626 |
}, |
| 2627 |
}, |
| 2628 |
|
| 2629 |
'CREATE FUNCTION dump_test.trigger_func' => { |
| 2630 |
create_order => 30, |
| 2631 |
create_sql => 'CREATE FUNCTION dump_test.trigger_func() |
| 2632 |
RETURNS trigger LANGUAGE plpgsql |
| 2633 |
AS $$ BEGIN RETURN NULL; END;$$;', |
| 2634 |
regexp => qr/^ |
| 2635 |
\QCREATE FUNCTION dump_test.trigger_func() RETURNS trigger\E |
| 2636 |
\n\s+\QLANGUAGE plpgsql\E |
| 2637 |
\n\s+AS\ \$\$ |
| 2638 |
\Q BEGIN RETURN NULL; END;\E |
| 2639 |
\$\$;/xm, |
| 2640 |
like => |
| 2641 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2642 |
unlike => { |
| 2643 |
exclude_dump_test_schema => 1, |
| 2644 |
only_dump_measurement => 1, |
| 2645 |
}, |
| 2646 |
}, |
| 2647 |
|
| 2648 |
'CREATE FUNCTION dump_test.event_trigger_func' => { |
| 2649 |
create_order => 32, |
| 2650 |
create_sql => 'CREATE FUNCTION dump_test.event_trigger_func() |
| 2651 |
RETURNS event_trigger LANGUAGE plpgsql |
| 2652 |
AS $$ BEGIN RETURN; END;$$;', |
| 2653 |
regexp => qr/^ |
| 2654 |
\QCREATE FUNCTION dump_test.event_trigger_func() RETURNS event_trigger\E |
| 2655 |
\n\s+\QLANGUAGE plpgsql\E |
| 2656 |
\n\s+AS\ \$\$ |
| 2657 |
\Q BEGIN RETURN; END;\E |
| 2658 |
\$\$;/xm, |
| 2659 |
like => |
| 2660 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2661 |
unlike => { |
| 2662 |
exclude_dump_test_schema => 1, |
| 2663 |
only_dump_measurement => 1, |
| 2664 |
}, |
| 2665 |
}, |
| 2666 |
|
| 2667 |
'CREATE OPERATOR FAMILY dump_test.op_family' => { |
| 2668 |
create_order => 73, |
| 2669 |
create_sql => |
| 2670 |
'CREATE OPERATOR FAMILY dump_test.op_family USING btree;', |
| 2671 |
regexp => qr/^ |
| 2672 |
\QCREATE OPERATOR FAMILY dump_test.op_family USING btree;\E |
| 2673 |
/xm, |
| 2674 |
like => |
| 2675 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2676 |
unlike => { |
| 2677 |
exclude_dump_test_schema => 1, |
| 2678 |
only_dump_measurement => 1, |
| 2679 |
}, |
| 2680 |
}, |
| 2681 |
|
| 2682 |
'CREATE OPERATOR CLASS dump_test.op_class' => { |
| 2683 |
create_order => 74, |
| 2684 |
create_sql => 'CREATE OPERATOR CLASS dump_test.op_class |
| 2685 |
FOR TYPE bigint USING btree FAMILY dump_test.op_family |
| 2686 |
AS STORAGE bigint, |
| 2687 |
OPERATOR 1 <(bigint,bigint), |
| 2688 |
OPERATOR 2 <=(bigint,bigint), |
| 2689 |
OPERATOR 3 =(bigint,bigint), |
| 2690 |
OPERATOR 4 >=(bigint,bigint), |
| 2691 |
OPERATOR 5 >(bigint,bigint), |
| 2692 |
FUNCTION 1 btint8cmp(bigint,bigint), |
| 2693 |
FUNCTION 2 btint8sortsupport(internal), |
| 2694 |
FUNCTION 4 btequalimage(oid);', |
| 2695 |
# note: it's correct that btint8sortsupport and btequalimage |
| 2696 |
# are NOT included here (they're optional support functions): |
| 2697 |
regexp => qr/^ |
| 2698 |
\QCREATE OPERATOR CLASS dump_test.op_class\E\n\s+ |
| 2699 |
\QFOR TYPE bigint USING btree FAMILY dump_test.op_family AS\E\n\s+ |
| 2700 |
\QOPERATOR 1 <(bigint,bigint) ,\E\n\s+ |
| 2701 |
\QOPERATOR 2 <=(bigint,bigint) ,\E\n\s+ |
| 2702 |
\QOPERATOR 3 =(bigint,bigint) ,\E\n\s+ |
| 2703 |
\QOPERATOR 4 >=(bigint,bigint) ,\E\n\s+ |
| 2704 |
\QOPERATOR 5 >(bigint,bigint) ,\E\n\s+ |
| 2705 |
\QFUNCTION 1 (bigint, bigint) btint8cmp(bigint,bigint);\E |
| 2706 |
/xm, |
| 2707 |
like => |
| 2708 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2709 |
unlike => { |
| 2710 |
exclude_dump_test_schema => 1, |
| 2711 |
only_dump_measurement => 1, |
| 2712 |
}, |
| 2713 |
}, |
| 2714 |
|
| 2715 |
# verify that a custom operator/opclass/range type is dumped in right order |
| 2716 |
'CREATE OPERATOR CLASS dump_test.op_class_custom' => { |
| 2717 |
create_order => 74, |
| 2718 |
create_sql => 'CREATE OPERATOR dump_test.~~ ( |
| 2719 |
PROCEDURE = int4eq, |
| 2720 |
LEFTARG = int, |
| 2721 |
RIGHTARG = int); |
| 2722 |
CREATE OPERATOR CLASS dump_test.op_class_custom |
| 2723 |
FOR TYPE int USING btree AS |
| 2724 |
OPERATOR 3 dump_test.~~; |
| 2725 |
CREATE TYPE dump_test.range_type_custom AS RANGE ( |
| 2726 |
subtype = int, |
| 2727 |
subtype_opclass = dump_test.op_class_custom);', |
| 2728 |
regexp => qr/^ |
| 2729 |
\QCREATE OPERATOR dump_test.~~ (\E\n.+ |
| 2730 |
\QCREATE OPERATOR FAMILY dump_test.op_class_custom USING btree;\E\n.+ |
| 2731 |
\QCREATE OPERATOR CLASS dump_test.op_class_custom\E\n\s+ |
| 2732 |
\QFOR TYPE integer USING btree FAMILY dump_test.op_class_custom AS\E\n\s+ |
| 2733 |
\QOPERATOR 3 dump_test.~~(integer,integer);\E\n.+ |
| 2734 |
\QCREATE TYPE dump_test.range_type_custom AS RANGE (\E\n\s+ |
| 2735 |
\Qsubtype = integer,\E\n\s+ |
| 2736 |
\Qmultirange_type_name = dump_test.multirange_type_custom,\E\n\s+ |
| 2737 |
\Qsubtype_opclass = dump_test.op_class_custom\E\n |
| 2738 |
\Q);\E |
| 2739 |
/xms, |
| 2740 |
like => |
| 2741 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2742 |
unlike => { |
| 2743 |
exclude_dump_test_schema => 1, |
| 2744 |
only_dump_measurement => 1, |
| 2745 |
}, |
| 2746 |
}, |
| 2747 |
|
| 2748 |
'CREATE OPERATOR CLASS dump_test.op_class_empty' => { |
| 2749 |
create_order => 89, |
| 2750 |
create_sql => 'CREATE OPERATOR CLASS dump_test.op_class_empty |
| 2751 |
FOR TYPE bigint USING btree FAMILY dump_test.op_family |
| 2752 |
AS STORAGE bigint;', |
| 2753 |
regexp => qr/^ |
| 2754 |
\QCREATE OPERATOR CLASS dump_test.op_class_empty\E\n\s+ |
| 2755 |
\QFOR TYPE bigint USING btree FAMILY dump_test.op_family AS\E\n\s+ |
| 2756 |
\QSTORAGE bigint;\E |
| 2757 |
/xm, |
| 2758 |
like => |
| 2759 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2760 |
unlike => { |
| 2761 |
exclude_dump_test_schema => 1, |
| 2762 |
only_dump_measurement => 1, |
| 2763 |
}, |
| 2764 |
}, |
| 2765 |
|
| 2766 |
'CREATE EVENT TRIGGER test_event_trigger' => { |
| 2767 |
create_order => 33, |
| 2768 |
create_sql => 'CREATE EVENT TRIGGER test_event_trigger |
| 2769 |
ON ddl_command_start |
| 2770 |
EXECUTE FUNCTION dump_test.event_trigger_func();', |
| 2771 |
regexp => qr/^ |
| 2772 |
\QCREATE EVENT TRIGGER test_event_trigger \E |
| 2773 |
\QON ddl_command_start\E |
| 2774 |
\n\s+\QEXECUTE FUNCTION dump_test.event_trigger_func();\E |
| 2775 |
/xm, |
| 2776 |
like => { %full_runs, section_post_data => 1, }, |
| 2777 |
}, |
| 2778 |
|
| 2779 |
'CREATE TRIGGER test_trigger' => { |
| 2780 |
create_order => 31, |
| 2781 |
create_sql => 'CREATE TRIGGER test_trigger |
| 2782 |
BEFORE INSERT ON dump_test.test_table |
| 2783 |
FOR EACH ROW WHEN (NEW.col1 > 10) |
| 2784 |
EXECUTE FUNCTION dump_test.trigger_func();', |
| 2785 |
regexp => qr/^ |
| 2786 |
\QCREATE TRIGGER test_trigger BEFORE INSERT ON dump_test.test_table \E |
| 2787 |
\QFOR EACH ROW WHEN ((new.col1 > 10)) \E |
| 2788 |
\QEXECUTE FUNCTION dump_test.trigger_func();\E |
| 2789 |
/xm, |
| 2790 |
like => { |
| 2791 |
%full_runs, |
| 2792 |
%dump_test_schema_runs, |
| 2793 |
only_dump_test_table => 1, |
| 2794 |
section_post_data => 1, |
| 2795 |
}, |
| 2796 |
unlike => { |
| 2797 |
exclude_test_table => 1, |
| 2798 |
exclude_dump_test_schema => 1, |
| 2799 |
only_dump_measurement => 1, |
| 2800 |
}, |
| 2801 |
}, |
| 2802 |
|
| 2803 |
'CREATE TYPE dump_test.planets AS ENUM' => { |
| 2804 |
create_order => 37, |
| 2805 |
create_sql => 'CREATE TYPE dump_test.planets |
| 2806 |
AS ENUM ( \'venus\', \'earth\', \'mars\' );', |
| 2807 |
regexp => qr/^ |
| 2808 |
\QCREATE TYPE dump_test.planets AS ENUM (\E |
| 2809 |
\n\s+'venus', |
| 2810 |
\n\s+'earth', |
| 2811 |
\n\s+'mars' |
| 2812 |
\n\);/xm, |
| 2813 |
like => |
| 2814 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2815 |
unlike => { |
| 2816 |
binary_upgrade => 1, |
| 2817 |
exclude_dump_test_schema => 1, |
| 2818 |
only_dump_measurement => 1, |
| 2819 |
}, |
| 2820 |
}, |
| 2821 |
|
| 2822 |
'CREATE TYPE dump_test.planets AS ENUM pg_upgrade' => { |
| 2823 |
regexp => qr/^ |
| 2824 |
\QCREATE TYPE dump_test.planets AS ENUM (\E |
| 2825 |
\n\);.*^ |
| 2826 |
\QALTER TYPE dump_test.planets ADD VALUE 'venus';\E |
| 2827 |
\n.*^ |
| 2828 |
\QALTER TYPE dump_test.planets ADD VALUE 'earth';\E |
| 2829 |
\n.*^ |
| 2830 |
\QALTER TYPE dump_test.planets ADD VALUE 'mars';\E |
| 2831 |
\n/xms, |
| 2832 |
like => { binary_upgrade => 1, }, |
| 2833 |
}, |
| 2834 |
|
| 2835 |
'CREATE TYPE dump_test.textrange AS RANGE' => { |
| 2836 |
create_order => 38, |
| 2837 |
create_sql => 'CREATE TYPE dump_test.textrange |
| 2838 |
AS RANGE (subtype=text, collation="C");', |
| 2839 |
regexp => qr/^ |
| 2840 |
\QCREATE TYPE dump_test.textrange AS RANGE (\E |
| 2841 |
\n\s+\Qsubtype = text,\E |
| 2842 |
\n\s+\Qmultirange_type_name = dump_test.textmultirange,\E |
| 2843 |
\n\s+\Qcollation = pg_catalog."C"\E |
| 2844 |
\n\);/xm, |
| 2845 |
like => |
| 2846 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2847 |
unlike => { |
| 2848 |
exclude_dump_test_schema => 1, |
| 2849 |
only_dump_measurement => 1, |
| 2850 |
}, |
| 2851 |
}, |
| 2852 |
|
| 2853 |
'CREATE TYPE dump_test.int42' => { |
| 2854 |
create_order => 39, |
| 2855 |
create_sql => 'CREATE TYPE dump_test.int42;', |
| 2856 |
regexp => qr/^\QCREATE TYPE dump_test.int42;\E/m, |
| 2857 |
like => |
| 2858 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2859 |
unlike => { |
| 2860 |
exclude_dump_test_schema => 1, |
| 2861 |
only_dump_measurement => 1, |
| 2862 |
}, |
| 2863 |
}, |
| 2864 |
|
| 2865 |
'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1' => { |
| 2866 |
create_order => 80, |
| 2867 |
create_sql => |
| 2868 |
'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (copy=english);', |
| 2869 |
regexp => qr/^ |
| 2870 |
\QCREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (\E\n |
| 2871 |
\s+\QPARSER = pg_catalog."default" );\E/xm, |
| 2872 |
like => |
| 2873 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2874 |
unlike => { |
| 2875 |
exclude_dump_test_schema => 1, |
| 2876 |
only_dump_measurement => 1, |
| 2877 |
}, |
| 2878 |
}, |
| 2879 |
|
| 2880 |
'ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 ...' => { |
| 2881 |
regexp => qr/^ |
| 2882 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2883 |
\s+\QADD MAPPING FOR asciiword WITH english_stem;\E\n |
| 2884 |
\n |
| 2885 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2886 |
\s+\QADD MAPPING FOR word WITH english_stem;\E\n |
| 2887 |
\n |
| 2888 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2889 |
\s+\QADD MAPPING FOR numword WITH simple;\E\n |
| 2890 |
\n |
| 2891 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2892 |
\s+\QADD MAPPING FOR email WITH simple;\E\n |
| 2893 |
\n |
| 2894 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2895 |
\s+\QADD MAPPING FOR url WITH simple;\E\n |
| 2896 |
\n |
| 2897 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2898 |
\s+\QADD MAPPING FOR host WITH simple;\E\n |
| 2899 |
\n |
| 2900 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2901 |
\s+\QADD MAPPING FOR sfloat WITH simple;\E\n |
| 2902 |
\n |
| 2903 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2904 |
\s+\QADD MAPPING FOR version WITH simple;\E\n |
| 2905 |
\n |
| 2906 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2907 |
\s+\QADD MAPPING FOR hword_numpart WITH simple;\E\n |
| 2908 |
\n |
| 2909 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2910 |
\s+\QADD MAPPING FOR hword_part WITH english_stem;\E\n |
| 2911 |
\n |
| 2912 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2913 |
\s+\QADD MAPPING FOR hword_asciipart WITH english_stem;\E\n |
| 2914 |
\n |
| 2915 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2916 |
\s+\QADD MAPPING FOR numhword WITH simple;\E\n |
| 2917 |
\n |
| 2918 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2919 |
\s+\QADD MAPPING FOR asciihword WITH english_stem;\E\n |
| 2920 |
\n |
| 2921 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2922 |
\s+\QADD MAPPING FOR hword WITH english_stem;\E\n |
| 2923 |
\n |
| 2924 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2925 |
\s+\QADD MAPPING FOR url_path WITH simple;\E\n |
| 2926 |
\n |
| 2927 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2928 |
\s+\QADD MAPPING FOR file WITH simple;\E\n |
| 2929 |
\n |
| 2930 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2931 |
\s+\QADD MAPPING FOR "float" WITH simple;\E\n |
| 2932 |
\n |
| 2933 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2934 |
\s+\QADD MAPPING FOR "int" WITH simple;\E\n |
| 2935 |
\n |
| 2936 |
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n |
| 2937 |
\s+\QADD MAPPING FOR uint WITH simple;\E\n |
| 2938 |
\n |
| 2939 |
/xm, |
| 2940 |
like => |
| 2941 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2942 |
unlike => { |
| 2943 |
exclude_dump_test_schema => 1, |
| 2944 |
only_dump_measurement => 1, |
| 2945 |
}, |
| 2946 |
}, |
| 2947 |
|
| 2948 |
'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => { |
| 2949 |
create_order => 81, |
| 2950 |
create_sql => |
| 2951 |
'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (lexize=dsimple_lexize);', |
| 2952 |
regexp => qr/^ |
| 2953 |
\QCREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (\E\n |
| 2954 |
\s+\QLEXIZE = dsimple_lexize );\E/xm, |
| 2955 |
like => |
| 2956 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2957 |
unlike => { |
| 2958 |
exclude_dump_test_schema => 1, |
| 2959 |
only_dump_measurement => 1, |
| 2960 |
}, |
| 2961 |
}, |
| 2962 |
|
| 2963 |
'CREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1' => { |
| 2964 |
create_order => 82, |
| 2965 |
create_sql => 'CREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1 |
| 2966 |
(start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);', |
| 2967 |
regexp => qr/^ |
| 2968 |
\QCREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1 (\E\n |
| 2969 |
\s+\QSTART = prsd_start,\E\n |
| 2970 |
\s+\QGETTOKEN = prsd_nexttoken,\E\n |
| 2971 |
\s+\QEND = prsd_end,\E\n |
| 2972 |
\s+\QLEXTYPES = prsd_lextype );\E\n |
| 2973 |
/xm, |
| 2974 |
like => |
| 2975 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2976 |
unlike => { |
| 2977 |
exclude_dump_test_schema => 1, |
| 2978 |
only_dump_measurement => 1, |
| 2979 |
}, |
| 2980 |
}, |
| 2981 |
|
| 2982 |
'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => { |
| 2983 |
create_order => 83, |
| 2984 |
create_sql => |
| 2985 |
'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (template=simple);', |
| 2986 |
regexp => qr/^ |
| 2987 |
\QCREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (\E\n |
| 2988 |
\s+\QTEMPLATE = pg_catalog.simple );\E\n |
| 2989 |
/xm, |
| 2990 |
like => |
| 2991 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 2992 |
unlike => { |
| 2993 |
exclude_dump_test_schema => 1, |
| 2994 |
only_dump_measurement => 1, |
| 2995 |
}, |
| 2996 |
}, |
| 2997 |
|
| 2998 |
'CREATE FUNCTION dump_test.int42_in' => { |
| 2999 |
create_order => 40, |
| 3000 |
create_sql => 'CREATE FUNCTION dump_test.int42_in(cstring) |
| 3001 |
RETURNS dump_test.int42 AS \'int4in\' |
| 3002 |
LANGUAGE internal STRICT IMMUTABLE;', |
| 3003 |
regexp => qr/^ |
| 3004 |
\QCREATE FUNCTION dump_test.int42_in(cstring) RETURNS dump_test.int42\E |
| 3005 |
\n\s+\QLANGUAGE internal IMMUTABLE STRICT\E |
| 3006 |
\n\s+AS\ \$\$int4in\$\$; |
| 3007 |
/xm, |
| 3008 |
like => |
| 3009 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3010 |
unlike => { |
| 3011 |
exclude_dump_test_schema => 1, |
| 3012 |
only_dump_measurement => 1, |
| 3013 |
}, |
| 3014 |
}, |
| 3015 |
|
| 3016 |
'CREATE FUNCTION dump_test.int42_out' => { |
| 3017 |
create_order => 41, |
| 3018 |
create_sql => 'CREATE FUNCTION dump_test.int42_out(dump_test.int42) |
| 3019 |
RETURNS cstring AS \'int4out\' |
| 3020 |
LANGUAGE internal STRICT IMMUTABLE;', |
| 3021 |
regexp => qr/^ |
| 3022 |
\QCREATE FUNCTION dump_test.int42_out(dump_test.int42) RETURNS cstring\E |
| 3023 |
\n\s+\QLANGUAGE internal IMMUTABLE STRICT\E |
| 3024 |
\n\s+AS\ \$\$int4out\$\$; |
| 3025 |
/xm, |
| 3026 |
like => |
| 3027 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3028 |
unlike => { |
| 3029 |
exclude_dump_test_schema => 1, |
| 3030 |
only_dump_measurement => 1, |
| 3031 |
}, |
| 3032 |
}, |
| 3033 |
|
| 3034 |
'CREATE FUNCTION ... SUPPORT' => { |
| 3035 |
create_order => 41, |
| 3036 |
create_sql => |
| 3037 |
'CREATE FUNCTION dump_test.func_with_support() RETURNS int LANGUAGE sql AS $$ SELECT 1 $$ SUPPORT varchar_support;', |
| 3038 |
regexp => qr/^ |
| 3039 |
\QCREATE FUNCTION dump_test.func_with_support() RETURNS integer\E |
| 3040 |
\n\s+\QLANGUAGE sql SUPPORT varchar_support\E |
| 3041 |
\n\s+AS\ \$\$\Q SELECT 1 \E\$\$; |
| 3042 |
/xm, |
| 3043 |
like => |
| 3044 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3045 |
unlike => { |
| 3046 |
exclude_dump_test_schema => 1, |
| 3047 |
only_dump_measurement => 1, |
| 3048 |
}, |
| 3049 |
}, |
| 3050 |
|
| 3051 |
'Check ordering of a function that depends on a primary key' => { |
| 3052 |
create_order => 41, |
| 3053 |
create_sql => ' |
| 3054 |
CREATE TABLE dump_test.ordering_table (id int primary key, data int); |
| 3055 |
CREATE FUNCTION dump_test.ordering_func () |
| 3056 |
RETURNS SETOF dump_test.ordering_table |
| 3057 |
LANGUAGE sql BEGIN ATOMIC |
| 3058 |
SELECT * FROM dump_test.ordering_table GROUP BY id; END;', |
| 3059 |
regexp => qr/^ |
| 3060 |
\QALTER TABLE ONLY dump_test.ordering_table\E |
| 3061 |
\n\s+\QADD CONSTRAINT ordering_table_pkey PRIMARY KEY (id);\E |
| 3062 |
.*^ |
| 3063 |
\QCREATE FUNCTION dump_test.ordering_func\E/xms, |
| 3064 |
like => |
| 3065 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 3066 |
unlike => { |
| 3067 |
exclude_dump_test_schema => 1, |
| 3068 |
only_dump_measurement => 1, |
| 3069 |
}, |
| 3070 |
}, |
| 3071 |
|
| 3072 |
'CREATE PROCEDURE dump_test.ptest1' => { |
| 3073 |
create_order => 41, |
| 3074 |
create_sql => 'CREATE PROCEDURE dump_test.ptest1(a int) |
| 3075 |
LANGUAGE SQL AS $$ INSERT INTO dump_test.test_table (col1) VALUES (a) $$;', |
| 3076 |
regexp => qr/^ |
| 3077 |
\QCREATE PROCEDURE dump_test.ptest1(IN a integer)\E |
| 3078 |
\n\s+\QLANGUAGE sql\E |
| 3079 |
\n\s+AS\ \$\$\Q INSERT INTO dump_test.test_table (col1) VALUES (a) \E\$\$; |
| 3080 |
/xm, |
| 3081 |
like => |
| 3082 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3083 |
unlike => { |
| 3084 |
exclude_dump_test_schema => 1, |
| 3085 |
only_dump_measurement => 1, |
| 3086 |
}, |
| 3087 |
}, |
| 3088 |
|
| 3089 |
'CREATE TYPE dump_test.int42 populated' => { |
| 3090 |
create_order => 42, |
| 3091 |
create_sql => 'CREATE TYPE dump_test.int42 ( |
| 3092 |
internallength = 4, |
| 3093 |
input = dump_test.int42_in, |
| 3094 |
output = dump_test.int42_out, |
| 3095 |
alignment = int4, |
| 3096 |
default = 42, |
| 3097 |
passedbyvalue);', |
| 3098 |
regexp => qr/^ |
| 3099 |
\QCREATE TYPE dump_test.int42 (\E |
| 3100 |
\n\s+\QINTERNALLENGTH = 4,\E |
| 3101 |
\n\s+\QINPUT = dump_test.int42_in,\E |
| 3102 |
\n\s+\QOUTPUT = dump_test.int42_out,\E |
| 3103 |
\n\s+\QDEFAULT = '42',\E |
| 3104 |
\n\s+\QALIGNMENT = int4,\E |
| 3105 |
\n\s+\QSTORAGE = plain,\E |
| 3106 |
\n\s+PASSEDBYVALUE\n\); |
| 3107 |
/xm, |
| 3108 |
like => |
| 3109 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3110 |
unlike => { |
| 3111 |
exclude_dump_test_schema => 1, |
| 3112 |
only_dump_measurement => 1, |
| 3113 |
}, |
| 3114 |
}, |
| 3115 |
|
| 3116 |
'CREATE TYPE dump_test.composite' => { |
| 3117 |
create_order => 43, |
| 3118 |
create_sql => 'CREATE TYPE dump_test.composite AS ( |
| 3119 |
f1 int, |
| 3120 |
f2 dump_test.int42 |
| 3121 |
);', |
| 3122 |
regexp => qr/^ |
| 3123 |
\QCREATE TYPE dump_test.composite AS (\E |
| 3124 |
\n\s+\Qf1 integer,\E |
| 3125 |
\n\s+\Qf2 dump_test.int42\E |
| 3126 |
\n\); |
| 3127 |
/xm, |
| 3128 |
like => |
| 3129 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3130 |
unlike => { |
| 3131 |
exclude_dump_test_schema => 1, |
| 3132 |
only_dump_measurement => 1, |
| 3133 |
}, |
| 3134 |
}, |
| 3135 |
|
| 3136 |
'CREATE TYPE dump_test.undefined' => { |
| 3137 |
create_order => 39, |
| 3138 |
create_sql => 'CREATE TYPE dump_test.undefined;', |
| 3139 |
regexp => qr/^\QCREATE TYPE dump_test.undefined;\E/m, |
| 3140 |
like => |
| 3141 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3142 |
unlike => { |
| 3143 |
exclude_dump_test_schema => 1, |
| 3144 |
only_dump_measurement => 1, |
| 3145 |
}, |
| 3146 |
}, |
| 3147 |
|
| 3148 |
'CREATE FOREIGN DATA WRAPPER dummy' => { |
| 3149 |
create_order => 35, |
| 3150 |
create_sql => 'CREATE FOREIGN DATA WRAPPER dummy;', |
| 3151 |
regexp => qr/CREATE FOREIGN DATA WRAPPER dummy;/m, |
| 3152 |
like => { %full_runs, section_pre_data => 1, }, |
| 3153 |
}, |
| 3154 |
|
| 3155 |
'CREATE SERVER s1 FOREIGN DATA WRAPPER dummy' => { |
| 3156 |
create_order => 36, |
| 3157 |
create_sql => 'CREATE SERVER s1 FOREIGN DATA WRAPPER dummy;', |
| 3158 |
regexp => qr/CREATE SERVER s1 FOREIGN DATA WRAPPER dummy;/m, |
| 3159 |
like => { %full_runs, section_pre_data => 1, }, |
| 3160 |
}, |
| 3161 |
|
| 3162 |
'CREATE FOREIGN TABLE dump_test.foreign_table SERVER s1' => { |
| 3163 |
create_order => 88, |
| 3164 |
create_sql => |
| 3165 |
'CREATE FOREIGN TABLE dump_test.foreign_table (c1 int options (column_name \'col1\')) |
| 3166 |
SERVER s1 OPTIONS (schema_name \'x1\');', |
| 3167 |
regexp => qr/ |
| 3168 |
\QCREATE FOREIGN TABLE dump_test.foreign_table (\E\n |
| 3169 |
\s+\Qc1 integer\E\n |
| 3170 |
\Q)\E\n |
| 3171 |
\QSERVER s1\E\n |
| 3172 |
\QOPTIONS (\E\n |
| 3173 |
\s+\Qschema_name 'x1'\E\n |
| 3174 |
\Q);\E\n |
| 3175 |
/xm, |
| 3176 |
like => |
| 3177 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3178 |
unlike => { |
| 3179 |
exclude_dump_test_schema => 1, |
| 3180 |
only_dump_measurement => 1, |
| 3181 |
}, |
| 3182 |
}, |
| 3183 |
|
| 3184 |
'CREATE USER MAPPING FOR regress_dump_test_role SERVER s1' => { |
| 3185 |
create_order => 86, |
| 3186 |
create_sql => |
| 3187 |
'CREATE USER MAPPING FOR regress_dump_test_role SERVER s1;', |
| 3188 |
regexp => |
| 3189 |
qr/CREATE USER MAPPING FOR regress_dump_test_role SERVER s1;/m, |
| 3190 |
like => { %full_runs, section_pre_data => 1, }, |
| 3191 |
}, |
| 3192 |
|
| 3193 |
'CREATE TRANSFORM FOR int' => { |
| 3194 |
create_order => 34, |
| 3195 |
create_sql => |
| 3196 |
'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION prsd_lextype(internal), TO SQL WITH FUNCTION int4recv(internal));', |
| 3197 |
regexp => |
| 3198 |
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, |
| 3199 |
like => { %full_runs, section_pre_data => 1, }, |
| 3200 |
}, |
| 3201 |
|
| 3202 |
'CREATE LANGUAGE pltestlang' => { |
| 3203 |
create_order => 18, |
| 3204 |
create_sql => 'CREATE LANGUAGE pltestlang |
| 3205 |
HANDLER dump_test.pltestlang_call_handler;', |
| 3206 |
regexp => qr/^ |
| 3207 |
\QCREATE PROCEDURAL LANGUAGE pltestlang \E |
| 3208 |
\QHANDLER dump_test.pltestlang_call_handler;\E |
| 3209 |
/xm, |
| 3210 |
like => { %full_runs, section_pre_data => 1, }, |
| 3211 |
unlike => { exclude_dump_test_schema => 1, }, |
| 3212 |
}, |
| 3213 |
|
| 3214 |
'CREATE MATERIALIZED VIEW matview' => { |
| 3215 |
create_order => 20, |
| 3216 |
create_sql => 'CREATE MATERIALIZED VIEW dump_test.matview (col1) AS |
| 3217 |
SELECT col1 FROM dump_test.test_table;', |
| 3218 |
regexp => qr/^ |
| 3219 |
\QCREATE MATERIALIZED VIEW dump_test.matview AS\E |
| 3220 |
\n\s+\QSELECT col1\E |
| 3221 |
\n\s+\QFROM dump_test.test_table\E |
| 3222 |
\n\s+\QWITH NO DATA;\E |
| 3223 |
/xm, |
| 3224 |
like => |
| 3225 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3226 |
unlike => { |
| 3227 |
exclude_dump_test_schema => 1, |
| 3228 |
only_dump_measurement => 1, |
| 3229 |
}, |
| 3230 |
}, |
| 3231 |
|
| 3232 |
'CREATE MATERIALIZED VIEW matview_second' => { |
| 3233 |
create_order => 21, |
| 3234 |
create_sql => 'CREATE MATERIALIZED VIEW |
| 3235 |
dump_test.matview_second (col1) AS |
| 3236 |
SELECT * FROM dump_test.matview;', |
| 3237 |
regexp => qr/^ |
| 3238 |
\QCREATE MATERIALIZED VIEW dump_test.matview_second AS\E |
| 3239 |
\n\s+\QSELECT col1\E |
| 3240 |
\n\s+\QFROM dump_test.matview\E |
| 3241 |
\n\s+\QWITH NO DATA;\E |
| 3242 |
/xm, |
| 3243 |
like => |
| 3244 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3245 |
unlike => { |
| 3246 |
exclude_dump_test_schema => 1, |
| 3247 |
only_dump_measurement => 1, |
| 3248 |
}, |
| 3249 |
}, |
| 3250 |
|
| 3251 |
'CREATE MATERIALIZED VIEW matview_third' => { |
| 3252 |
create_order => 58, |
| 3253 |
create_sql => 'CREATE MATERIALIZED VIEW |
| 3254 |
dump_test.matview_third (col1) AS |
| 3255 |
SELECT * FROM dump_test.matview_second WITH NO DATA;', |
| 3256 |
regexp => qr/^ |
| 3257 |
\QCREATE MATERIALIZED VIEW dump_test.matview_third AS\E |
| 3258 |
\n\s+\QSELECT col1\E |
| 3259 |
\n\s+\QFROM dump_test.matview_second\E |
| 3260 |
\n\s+\QWITH NO DATA;\E |
| 3261 |
/xm, |
| 3262 |
like => |
| 3263 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3264 |
unlike => { |
| 3265 |
exclude_dump_test_schema => 1, |
| 3266 |
only_dump_measurement => 1, |
| 3267 |
}, |
| 3268 |
}, |
| 3269 |
|
| 3270 |
'CREATE MATERIALIZED VIEW matview_fourth' => { |
| 3271 |
create_order => 59, |
| 3272 |
create_sql => 'CREATE MATERIALIZED VIEW |
| 3273 |
dump_test.matview_fourth (col1) AS |
| 3274 |
SELECT * FROM dump_test.matview_third WITH NO DATA;', |
| 3275 |
regexp => qr/^ |
| 3276 |
\QCREATE MATERIALIZED VIEW dump_test.matview_fourth AS\E |
| 3277 |
\n\s+\QSELECT col1\E |
| 3278 |
\n\s+\QFROM dump_test.matview_third\E |
| 3279 |
\n\s+\QWITH NO DATA;\E |
| 3280 |
/xm, |
| 3281 |
like => |
| 3282 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3283 |
unlike => { |
| 3284 |
exclude_dump_test_schema => 1, |
| 3285 |
only_dump_measurement => 1, |
| 3286 |
}, |
| 3287 |
}, |
| 3288 |
|
| 3289 |
'CREATE MATERIALIZED VIEW matview_compression' => { |
| 3290 |
create_order => 20, |
| 3291 |
create_sql => 'CREATE MATERIALIZED VIEW |
| 3292 |
dump_test.matview_compression (col2) AS |
| 3293 |
SELECT col2 FROM dump_test.test_table; |
| 3294 |
ALTER MATERIALIZED VIEW dump_test.matview_compression |
| 3295 |
ALTER COLUMN col2 SET COMPRESSION lz4;', |
| 3296 |
regexp => qr/^ |
| 3297 |
\QCREATE MATERIALIZED VIEW dump_test.matview_compression AS\E |
| 3298 |
\n\s+\QSELECT col2\E |
| 3299 |
\n\s+\QFROM dump_test.test_table\E |
| 3300 |
\n\s+\QWITH NO DATA;\E |
| 3301 |
.* |
| 3302 |
\QALTER TABLE ONLY dump_test.matview_compression ALTER COLUMN col2 SET COMPRESSION lz4;\E\n |
| 3303 |
/xms, |
| 3304 |
lz4 => 1, |
| 3305 |
like => |
| 3306 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3307 |
unlike => { |
| 3308 |
exclude_dump_test_schema => 1, |
| 3309 |
no_toast_compression => 1, |
| 3310 |
only_dump_measurement => 1, |
| 3311 |
}, |
| 3312 |
}, |
| 3313 |
|
| 3314 |
'Check ordering of a matview that depends on a primary key' => { |
| 3315 |
create_order => 42, |
| 3316 |
create_sql => ' |
| 3317 |
CREATE MATERIALIZED VIEW dump_test.ordering_view AS |
| 3318 |
SELECT * FROM dump_test.ordering_table GROUP BY id;', |
| 3319 |
regexp => qr/^ |
| 3320 |
\QALTER TABLE ONLY dump_test.ordering_table\E |
| 3321 |
\n\s+\QADD CONSTRAINT ordering_table_pkey PRIMARY KEY (id);\E |
| 3322 |
.*^ |
| 3323 |
\QCREATE MATERIALIZED VIEW dump_test.ordering_view AS\E |
| 3324 |
\n\s+\QSELECT id,\E/xms, |
| 3325 |
like => |
| 3326 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 3327 |
unlike => { |
| 3328 |
exclude_dump_test_schema => 1, |
| 3329 |
only_dump_measurement => 1, |
| 3330 |
}, |
| 3331 |
}, |
| 3332 |
|
| 3333 |
'CREATE POLICY p1 ON test_table' => { |
| 3334 |
create_order => 22, |
| 3335 |
create_sql => 'CREATE POLICY p1 ON dump_test.test_table |
| 3336 |
USING (true) |
| 3337 |
WITH CHECK (true);', |
| 3338 |
regexp => qr/^ |
| 3339 |
\QCREATE POLICY p1 ON dump_test.test_table \E |
| 3340 |
\QUSING (true) WITH CHECK (true);\E |
| 3341 |
/xm, |
| 3342 |
like => { |
| 3343 |
%full_runs, |
| 3344 |
%dump_test_schema_runs, |
| 3345 |
only_dump_test_table => 1, |
| 3346 |
section_post_data => 1, |
| 3347 |
}, |
| 3348 |
unlike => { |
| 3349 |
exclude_dump_test_schema => 1, |
| 3350 |
exclude_test_table => 1, |
| 3351 |
no_policies => 1, |
| 3352 |
no_policies_restore => 1, |
| 3353 |
only_dump_measurement => 1, |
| 3354 |
}, |
| 3355 |
}, |
| 3356 |
|
| 3357 |
'CREATE POLICY p2 ON test_table FOR SELECT' => { |
| 3358 |
create_order => 24, |
| 3359 |
create_sql => 'CREATE POLICY p2 ON dump_test.test_table |
| 3360 |
FOR SELECT TO regress_dump_test_role USING (true);', |
| 3361 |
regexp => qr/^ |
| 3362 |
\QCREATE POLICY p2 ON dump_test.test_table FOR SELECT TO regress_dump_test_role \E |
| 3363 |
\QUSING (true);\E |
| 3364 |
/xm, |
| 3365 |
like => { |
| 3366 |
%full_runs, |
| 3367 |
%dump_test_schema_runs, |
| 3368 |
only_dump_test_table => 1, |
| 3369 |
section_post_data => 1, |
| 3370 |
}, |
| 3371 |
unlike => { |
| 3372 |
exclude_dump_test_schema => 1, |
| 3373 |
exclude_test_table => 1, |
| 3374 |
no_policies => 1, |
| 3375 |
no_policies_restore => 1, |
| 3376 |
only_dump_measurement => 1, |
| 3377 |
}, |
| 3378 |
}, |
| 3379 |
|
| 3380 |
'CREATE POLICY p3 ON test_table FOR INSERT' => { |
| 3381 |
create_order => 25, |
| 3382 |
create_sql => 'CREATE POLICY p3 ON dump_test.test_table |
| 3383 |
FOR INSERT TO regress_dump_test_role WITH CHECK (true);', |
| 3384 |
regexp => qr/^ |
| 3385 |
\QCREATE POLICY p3 ON dump_test.test_table FOR INSERT \E |
| 3386 |
\QTO regress_dump_test_role WITH CHECK (true);\E |
| 3387 |
/xm, |
| 3388 |
like => { |
| 3389 |
%full_runs, |
| 3390 |
%dump_test_schema_runs, |
| 3391 |
only_dump_test_table => 1, |
| 3392 |
section_post_data => 1, |
| 3393 |
}, |
| 3394 |
unlike => { |
| 3395 |
exclude_dump_test_schema => 1, |
| 3396 |
exclude_test_table => 1, |
| 3397 |
no_policies => 1, |
| 3398 |
no_policies_restore => 1, |
| 3399 |
only_dump_measurement => 1, |
| 3400 |
}, |
| 3401 |
}, |
| 3402 |
|
| 3403 |
'CREATE POLICY p4 ON test_table FOR UPDATE' => { |
| 3404 |
create_order => 26, |
| 3405 |
create_sql => 'CREATE POLICY p4 ON dump_test.test_table FOR UPDATE |
| 3406 |
TO regress_dump_test_role USING (true) WITH CHECK (true);', |
| 3407 |
regexp => qr/^ |
| 3408 |
\QCREATE POLICY p4 ON dump_test.test_table FOR UPDATE TO regress_dump_test_role \E |
| 3409 |
\QUSING (true) WITH CHECK (true);\E |
| 3410 |
/xm, |
| 3411 |
like => { |
| 3412 |
%full_runs, |
| 3413 |
%dump_test_schema_runs, |
| 3414 |
only_dump_test_table => 1, |
| 3415 |
section_post_data => 1, |
| 3416 |
}, |
| 3417 |
unlike => { |
| 3418 |
exclude_dump_test_schema => 1, |
| 3419 |
exclude_test_table => 1, |
| 3420 |
no_policies => 1, |
| 3421 |
no_policies_restore => 1, |
| 3422 |
only_dump_measurement => 1, |
| 3423 |
}, |
| 3424 |
}, |
| 3425 |
|
| 3426 |
'CREATE POLICY p5 ON test_table FOR DELETE' => { |
| 3427 |
create_order => 27, |
| 3428 |
create_sql => 'CREATE POLICY p5 ON dump_test.test_table |
| 3429 |
FOR DELETE TO regress_dump_test_role USING (true);', |
| 3430 |
regexp => qr/^ |
| 3431 |
\QCREATE POLICY p5 ON dump_test.test_table FOR DELETE \E |
| 3432 |
\QTO regress_dump_test_role USING (true);\E |
| 3433 |
/xm, |
| 3434 |
like => { |
| 3435 |
%full_runs, |
| 3436 |
%dump_test_schema_runs, |
| 3437 |
only_dump_test_table => 1, |
| 3438 |
section_post_data => 1, |
| 3439 |
}, |
| 3440 |
unlike => { |
| 3441 |
exclude_dump_test_schema => 1, |
| 3442 |
exclude_test_table => 1, |
| 3443 |
no_policies => 1, |
| 3444 |
no_policies_restore => 1, |
| 3445 |
only_dump_measurement => 1, |
| 3446 |
}, |
| 3447 |
}, |
| 3448 |
|
| 3449 |
'CREATE POLICY p6 ON test_table AS RESTRICTIVE' => { |
| 3450 |
create_order => 27, |
| 3451 |
create_sql => 'CREATE POLICY p6 ON dump_test.test_table AS RESTRICTIVE |
| 3452 |
USING (false);', |
| 3453 |
regexp => qr/^ |
| 3454 |
\QCREATE POLICY p6 ON dump_test.test_table AS RESTRICTIVE \E |
| 3455 |
\QUSING (false);\E |
| 3456 |
/xm, |
| 3457 |
like => { |
| 3458 |
%full_runs, |
| 3459 |
%dump_test_schema_runs, |
| 3460 |
only_dump_test_table => 1, |
| 3461 |
section_post_data => 1, |
| 3462 |
}, |
| 3463 |
unlike => { |
| 3464 |
exclude_dump_test_schema => 1, |
| 3465 |
exclude_test_table => 1, |
| 3466 |
no_policies => 1, |
| 3467 |
no_policies_restore => 1, |
| 3468 |
only_dump_measurement => 1, |
| 3469 |
}, |
| 3470 |
}, |
| 3471 |
|
| 3472 |
'CREATE PUBLICATION pub1' => { |
| 3473 |
create_order => 50, |
| 3474 |
create_sql => 'CREATE PUBLICATION pub1;', |
| 3475 |
regexp => qr/^ |
| 3476 |
\QCREATE PUBLICATION pub1 WITH (publish = 'insert, update, delete, truncate');\E |
| 3477 |
/xm, |
| 3478 |
like => { %full_runs, section_post_data => 1, }, |
| 3479 |
}, |
| 3480 |
|
| 3481 |
'CREATE PUBLICATION pub2' => { |
| 3482 |
create_order => 50, |
| 3483 |
create_sql => 'CREATE PUBLICATION pub2 |
| 3484 |
FOR ALL TABLES |
| 3485 |
WITH (publish = \'\');', |
| 3486 |
regexp => qr/^ |
| 3487 |
\QCREATE PUBLICATION pub2 FOR ALL TABLES WITH (publish = '');\E |
| 3488 |
/xm, |
| 3489 |
like => { %full_runs, section_post_data => 1, }, |
| 3490 |
}, |
| 3491 |
|
| 3492 |
'CREATE PUBLICATION pub3' => { |
| 3493 |
create_order => 50, |
| 3494 |
create_sql => 'CREATE PUBLICATION pub3;', |
| 3495 |
regexp => qr/^ |
| 3496 |
\QCREATE PUBLICATION pub3 WITH (publish = 'insert, update, delete, truncate');\E |
| 3497 |
/xm, |
| 3498 |
like => { %full_runs, section_post_data => 1, }, |
| 3499 |
}, |
| 3500 |
|
| 3501 |
'CREATE PUBLICATION pub4' => { |
| 3502 |
create_order => 50, |
| 3503 |
create_sql => 'CREATE PUBLICATION pub4;', |
| 3504 |
regexp => qr/^ |
| 3505 |
\QCREATE PUBLICATION pub4 WITH (publish = 'insert, update, delete, truncate');\E |
| 3506 |
/xm, |
| 3507 |
like => { %full_runs, section_post_data => 1, }, |
| 3508 |
}, |
| 3509 |
|
| 3510 |
'CREATE PUBLICATION pub5' => { |
| 3511 |
create_order => 50, |
| 3512 |
create_sql => |
| 3513 |
'CREATE PUBLICATION pub5 WITH (publish_generated_columns = stored);', |
| 3514 |
regexp => qr/^ |
| 3515 |
\QCREATE PUBLICATION pub5 WITH (publish = 'insert, update, delete, truncate', publish_generated_columns = stored);\E |
| 3516 |
/xm, |
| 3517 |
like => { %full_runs, section_post_data => 1, }, |
| 3518 |
}, |
| 3519 |
|
| 3520 |
'CREATE SUBSCRIPTION sub1' => { |
| 3521 |
create_order => 50, |
| 3522 |
create_sql => 'CREATE SUBSCRIPTION sub1 |
| 3523 |
CONNECTION \'dbname=doesnotexist\' PUBLICATION pub1 |
| 3524 |
WITH (connect = false);', |
| 3525 |
regexp => qr/^ |
| 3526 |
\QCREATE SUBSCRIPTION sub1 CONNECTION 'dbname=doesnotexist' PUBLICATION pub1 WITH (connect = false, slot_name = 'sub1', streaming = parallel);\E |
| 3527 |
/xm, |
| 3528 |
like => { %full_runs, section_post_data => 1, }, |
| 3529 |
unlike => { |
| 3530 |
no_subscriptions => 1, |
| 3531 |
no_subscriptions_restore => 1, |
| 3532 |
}, |
| 3533 |
}, |
| 3534 |
|
| 3535 |
'CREATE SUBSCRIPTION sub2' => { |
| 3536 |
create_order => 50, |
| 3537 |
create_sql => 'CREATE SUBSCRIPTION sub2 |
| 3538 |
CONNECTION \'dbname=doesnotexist\' PUBLICATION pub1 |
| 3539 |
WITH (connect = false, origin = none, streaming = off);', |
| 3540 |
regexp => qr/^ |
| 3541 |
\QCREATE SUBSCRIPTION sub2 CONNECTION 'dbname=doesnotexist' PUBLICATION pub1 WITH (connect = false, slot_name = 'sub2', streaming = off, origin = none);\E |
| 3542 |
/xm, |
| 3543 |
like => { %full_runs, section_post_data => 1, }, |
| 3544 |
unlike => { |
| 3545 |
no_subscriptions => 1, |
| 3546 |
no_subscriptions_restore => 1, |
| 3547 |
}, |
| 3548 |
}, |
| 3549 |
|
| 3550 |
'CREATE SUBSCRIPTION sub3' => { |
| 3551 |
create_order => 50, |
| 3552 |
create_sql => 'CREATE SUBSCRIPTION sub3 |
| 3553 |
CONNECTION \'dbname=doesnotexist\' PUBLICATION pub1 |
| 3554 |
WITH (connect = false, origin = any, streaming = on);', |
| 3555 |
regexp => qr/^ |
| 3556 |
\QCREATE SUBSCRIPTION sub3 CONNECTION 'dbname=doesnotexist' PUBLICATION pub1 WITH (connect = false, slot_name = 'sub3', streaming = on);\E |
| 3557 |
/xm, |
| 3558 |
like => { %full_runs, section_post_data => 1, }, |
| 3559 |
unlike => { |
| 3560 |
no_subscriptions => 1, |
| 3561 |
no_subscriptions_restore => 1, |
| 3562 |
}, |
| 3563 |
}, |
| 3564 |
|
| 3565 |
|
| 3566 |
# Regardless of whether the table or schema is excluded, publications must |
| 3567 |
# still be dumped, as excluded objects do not apply to publications. We |
| 3568 |
# perform table and schema exclusion via full_runs. |
| 3569 |
'ALTER PUBLICATION pub1 ADD TABLE test_table' => { |
| 3570 |
create_order => 51, |
| 3571 |
create_sql => |
| 3572 |
'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_table;', |
| 3573 |
regexp => qr/^ |
| 3574 |
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_table;\E |
| 3575 |
/xm, |
| 3576 |
like => { %full_runs, section_post_data => 1, }, |
| 3577 |
}, |
| 3578 |
|
| 3579 |
# Regardless of whether the table or schema is excluded, publications must |
| 3580 |
# still be dumped, as excluded objects do not apply to publications. We |
| 3581 |
# perform table and schema exclusion via full_runs. |
| 3582 |
'ALTER PUBLICATION pub1 ADD TABLE test_second_table' => { |
| 3583 |
create_order => 52, |
| 3584 |
create_sql => |
| 3585 |
'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_second_table;', |
| 3586 |
regexp => qr/^ |
| 3587 |
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_second_table;\E |
| 3588 |
/xm, |
| 3589 |
like => { %full_runs, section_post_data => 1, }, |
| 3590 |
}, |
| 3591 |
|
| 3592 |
# Regardless of whether the table or schema is excluded, publications must |
| 3593 |
# still be dumped, as excluded objects do not apply to publications. We |
| 3594 |
# perform table and schema exclusion via full_runs. |
| 3595 |
'ALTER PUBLICATION pub1 ADD TABLE test_sixth_table (col3, col2)' => { |
| 3596 |
create_order => 52, |
| 3597 |
create_sql => |
| 3598 |
'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_sixth_table (col3, col2);', |
| 3599 |
regexp => qr/^ |
| 3600 |
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_sixth_table (col2, col3);\E |
| 3601 |
/xm, |
| 3602 |
like => { %full_runs, section_post_data => 1, }, |
| 3603 |
}, |
| 3604 |
|
| 3605 |
# Regardless of whether the table or schema is excluded, publications must |
| 3606 |
# still be dumped, as excluded objects do not apply to publications. We |
| 3607 |
# perform table and schema exclusion via full_runs. |
| 3608 |
'ALTER PUBLICATION pub1 ADD TABLE test_seventh_table (col3, col2) WHERE (col1 = 1)' |
| 3609 |
=> { |
| 3610 |
create_order => 52, |
| 3611 |
create_sql => |
| 3612 |
'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_seventh_table (col3, col2) WHERE (col1 = 1);', |
| 3613 |
regexp => qr/^ |
| 3614 |
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_seventh_table (col2, col3) WHERE ((col1 = 1));\E |
| 3615 |
/xm, |
| 3616 |
like => { %full_runs, section_post_data => 1, }, |
| 3617 |
}, |
| 3618 |
|
| 3619 |
# Regardless of whether the table or schema is excluded, publications must |
| 3620 |
# still be dumped, as excluded objects do not apply to publications. We |
| 3621 |
# perform table and schema exclusion via full_runs. |
| 3622 |
'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test' => { |
| 3623 |
create_order => 51, |
| 3624 |
create_sql => |
| 3625 |
'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test;', |
| 3626 |
regexp => qr/^ |
| 3627 |
\QALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test;\E |
| 3628 |
/xm, |
| 3629 |
like => { %full_runs, section_post_data => 1, }, |
| 3630 |
}, |
| 3631 |
|
| 3632 |
# Regardless of whether the table or schema is excluded, publications must |
| 3633 |
# still be dumped, as excluded objects do not apply to publications. We |
| 3634 |
# perform table and schema exclusion via full_runs. |
| 3635 |
'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public' => { |
| 3636 |
create_order => 52, |
| 3637 |
create_sql => 'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public;', |
| 3638 |
regexp => qr/^ |
| 3639 |
\QALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public;\E |
| 3640 |
/xm, |
| 3641 |
like => { %full_runs, section_post_data => 1, }, |
| 3642 |
}, |
| 3643 |
|
| 3644 |
# Regardless of whether the table or schema is excluded, publications must |
| 3645 |
# still be dumped, as excluded objects do not apply to publications. We |
| 3646 |
# perform table and schema exclusion via full_runs. |
| 3647 |
'ALTER PUBLICATION pub3 ADD TABLE test_table' => { |
| 3648 |
create_order => 51, |
| 3649 |
create_sql => |
| 3650 |
'ALTER PUBLICATION pub3 ADD TABLE dump_test.test_table;', |
| 3651 |
regexp => qr/^ |
| 3652 |
\QALTER PUBLICATION pub3 ADD TABLE ONLY dump_test.test_table;\E |
| 3653 |
/xm, |
| 3654 |
like => { %full_runs, section_post_data => 1, }, |
| 3655 |
}, |
| 3656 |
|
| 3657 |
# Regardless of whether the table or schema is excluded, publications must |
| 3658 |
# still be dumped, as excluded objects do not apply to publications. We |
| 3659 |
# perform table and schema exclusion via full_runs. |
| 3660 |
'ALTER PUBLICATION pub4 ADD TABLE test_table WHERE (col1 > 0);' => { |
| 3661 |
create_order => 51, |
| 3662 |
create_sql => |
| 3663 |
'ALTER PUBLICATION pub4 ADD TABLE dump_test.test_table WHERE (col1 > 0);', |
| 3664 |
regexp => qr/^ |
| 3665 |
\QALTER PUBLICATION pub4 ADD TABLE ONLY dump_test.test_table WHERE ((col1 > 0));\E |
| 3666 |
/xm, |
| 3667 |
like => { %full_runs, section_post_data => 1, }, |
| 3668 |
}, |
| 3669 |
|
| 3670 |
# Regardless of whether the table or schema is excluded, publications must |
| 3671 |
# still be dumped, as excluded objects do not apply to publications. We |
| 3672 |
# perform table and schema exclusion via full_runs. |
| 3673 |
'ALTER PUBLICATION pub4 ADD TABLE test_second_table WHERE (col2 = \'test\');' |
| 3674 |
=> { |
| 3675 |
create_order => 52, |
| 3676 |
create_sql => |
| 3677 |
'ALTER PUBLICATION pub4 ADD TABLE dump_test.test_second_table WHERE (col2 = \'test\');', |
| 3678 |
regexp => qr/^ |
| 3679 |
\QALTER PUBLICATION pub4 ADD TABLE ONLY dump_test.test_second_table WHERE ((col2 = 'test'::text));\E |
| 3680 |
/xm, |
| 3681 |
like => { %full_runs, section_post_data => 1, }, |
| 3682 |
}, |
| 3683 |
|
| 3684 |
'CREATE SCHEMA public' => { |
| 3685 |
regexp => qr/^CREATE SCHEMA public;/m, |
| 3686 |
|
| 3687 |
# this shouldn't ever get emitted anymore |
| 3688 |
like => {}, |
| 3689 |
}, |
| 3690 |
|
| 3691 |
'CREATE SCHEMA dump_test' => { |
| 3692 |
create_order => 2, |
| 3693 |
create_sql => 'CREATE SCHEMA dump_test;', |
| 3694 |
regexp => qr/^CREATE SCHEMA dump_test;/m, |
| 3695 |
like => |
| 3696 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3697 |
unlike => { |
| 3698 |
exclude_dump_test_schema => 1, |
| 3699 |
only_dump_measurement => 1, |
| 3700 |
}, |
| 3701 |
}, |
| 3702 |
|
| 3703 |
'CREATE SCHEMA dump_test_second_schema' => { |
| 3704 |
create_order => 9, |
| 3705 |
create_sql => 'CREATE SCHEMA dump_test_second_schema;', |
| 3706 |
regexp => qr/^CREATE SCHEMA dump_test_second_schema;/m, |
| 3707 |
like => { |
| 3708 |
%full_runs, |
| 3709 |
role => 1, |
| 3710 |
section_pre_data => 1, |
| 3711 |
}, |
| 3712 |
}, |
| 3713 |
|
| 3714 |
'CREATE TABLE test_table' => { |
| 3715 |
create_order => 3, |
| 3716 |
create_sql => 'CREATE TABLE dump_test.test_table ( |
| 3717 |
col1 serial primary key, |
| 3718 |
col2 text COMPRESSION pglz, |
| 3719 |
col3 text, |
| 3720 |
col4 text, |
| 3721 |
CHECK (col1 <= 1000) |
| 3722 |
) WITH (autovacuum_enabled = false, fillfactor=80); |
| 3723 |
COMMENT ON CONSTRAINT test_table_col1_check |
| 3724 |
ON dump_test.test_table IS \'bounds check\';', |
| 3725 |
regexp => qr/^ |
| 3726 |
\QCREATE TABLE dump_test.test_table (\E\n |
| 3727 |
\s+\Qcol1 integer NOT NULL,\E\n |
| 3728 |
\s+\Qcol2 text,\E\n |
| 3729 |
\s+\Qcol3 text,\E\n |
| 3730 |
\s+\Qcol4 text,\E\n |
| 3731 |
\s+\QCONSTRAINT test_table_col1_check CHECK ((col1 <= 1000))\E\n |
| 3732 |
\Q)\E\n |
| 3733 |
\QWITH (autovacuum_enabled='false', fillfactor='80');\E\n(.|\n)* |
| 3734 |
\QCOMMENT ON CONSTRAINT test_table_col1_check ON dump_test.test_table IS 'bounds check';\E |
| 3735 |
/xm, |
| 3736 |
like => { |
| 3737 |
%full_runs, |
| 3738 |
%dump_test_schema_runs, |
| 3739 |
only_dump_test_table => 1, |
| 3740 |
section_pre_data => 1, |
| 3741 |
}, |
| 3742 |
unlike => { |
| 3743 |
exclude_dump_test_schema => 1, |
| 3744 |
exclude_test_table => 1, |
| 3745 |
only_dump_measurement => 1, |
| 3746 |
}, |
| 3747 |
}, |
| 3748 |
|
| 3749 |
'CREATE TABLE test_compression_method' => { |
| 3750 |
create_order => 110, |
| 3751 |
create_sql => 'CREATE TABLE dump_test.test_compression_method ( |
| 3752 |
col1 text |
| 3753 |
);', |
| 3754 |
regexp => qr/^ |
| 3755 |
\QCREATE TABLE dump_test.test_compression_method (\E\n |
| 3756 |
\s+\Qcol1 text\E\n |
| 3757 |
\Q);\E |
| 3758 |
/xm, |
| 3759 |
like => { |
| 3760 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 3761 |
}, |
| 3762 |
unlike => { |
| 3763 |
exclude_dump_test_schema => 1, |
| 3764 |
only_dump_measurement => 1, |
| 3765 |
}, |
| 3766 |
}, |
| 3767 |
|
| 3768 |
# Insert enough data to surpass DEFAULT_IO_BUFFER_SIZE during |
| 3769 |
# (de)compression operations |
| 3770 |
'COPY test_compression_method' => { |
| 3771 |
create_order => 111, |
| 3772 |
create_sql => 'INSERT INTO dump_test.test_compression_method (col1) ' |
| 3773 |
. 'SELECT string_agg(a::text, \'\') FROM generate_series(1,4096) a;', |
| 3774 |
regexp => qr/^ |
| 3775 |
\QCOPY dump_test.test_compression_method (col1) FROM stdin;\E |
| 3776 |
\n(?:\d{15277}\n){1}\\\.\n |
| 3777 |
/xm, |
| 3778 |
like => { |
| 3779 |
%full_runs, |
| 3780 |
data_only => 1, |
| 3781 |
no_schema => 1, |
| 3782 |
section_data => 1, |
| 3783 |
only_dump_test_schema => 1, |
| 3784 |
test_schema_plus_large_objects => 1, |
| 3785 |
}, |
| 3786 |
unlike => { |
| 3787 |
binary_upgrade => 1, |
| 3788 |
exclude_dump_test_schema => 1, |
| 3789 |
schema_only => 1, |
| 3790 |
}, |
| 3791 |
}, |
| 3792 |
|
| 3793 |
'CREATE TABLE fk_reference_test_table' => { |
| 3794 |
create_order => 21, |
| 3795 |
create_sql => 'CREATE TABLE dump_test.fk_reference_test_table ( |
| 3796 |
col1 int primary key references dump_test.test_table |
| 3797 |
);', |
| 3798 |
regexp => qr/^ |
| 3799 |
\QCREATE TABLE dump_test.fk_reference_test_table (\E |
| 3800 |
\n\s+\Qcol1 integer NOT NULL\E |
| 3801 |
\n\); |
| 3802 |
/xm, |
| 3803 |
like => |
| 3804 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3805 |
unlike => { |
| 3806 |
exclude_dump_test_schema => 1, |
| 3807 |
only_dump_measurement => 1, |
| 3808 |
}, |
| 3809 |
}, |
| 3810 |
|
| 3811 |
'CREATE TABLE test_second_table' => { |
| 3812 |
create_order => 6, |
| 3813 |
create_sql => 'CREATE TABLE dump_test.test_second_table ( |
| 3814 |
col1 int, |
| 3815 |
col2 text |
| 3816 |
);', |
| 3817 |
regexp => qr/^ |
| 3818 |
\QCREATE TABLE dump_test.test_second_table (\E |
| 3819 |
\n\s+\Qcol1 integer,\E |
| 3820 |
\n\s+\Qcol2 text\E |
| 3821 |
\n\); |
| 3822 |
/xm, |
| 3823 |
like => |
| 3824 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3825 |
unlike => { |
| 3826 |
exclude_dump_test_schema => 1, |
| 3827 |
only_dump_measurement => 1, |
| 3828 |
}, |
| 3829 |
}, |
| 3830 |
|
| 3831 |
'CREATE TABLE test_compression' => { |
| 3832 |
create_order => 3, |
| 3833 |
create_sql => 'CREATE TABLE dump_test.test_compression ( |
| 3834 |
col1 int, |
| 3835 |
col2 text COMPRESSION lz4 |
| 3836 |
);', |
| 3837 |
regexp => qr/^ |
| 3838 |
\QCREATE TABLE dump_test.test_compression (\E\n |
| 3839 |
\s+\Qcol1 integer,\E\n |
| 3840 |
\s+\Qcol2 text\E\n |
| 3841 |
\);\n |
| 3842 |
.* |
| 3843 |
\QALTER TABLE ONLY dump_test.test_compression ALTER COLUMN col2 SET COMPRESSION lz4;\E\n |
| 3844 |
/xms, |
| 3845 |
lz4 => 1, |
| 3846 |
like => |
| 3847 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 3848 |
unlike => { |
| 3849 |
exclude_dump_test_schema => 1, |
| 3850 |
no_toast_compression => 1, |
| 3851 |
only_dump_measurement => 1, |
| 3852 |
}, |
| 3853 |
}, |
| 3854 |
|
| 3855 |
'CREATE TABLE measurement PARTITIONED BY' => { |
| 3856 |
create_order => 90, |
| 3857 |
create_sql => 'CREATE TABLE dump_test.measurement ( |
| 3858 |
city_id serial not null, |
| 3859 |
logdate date not null, |
| 3860 |
peaktemp int CHECK (peaktemp >= -460), |
| 3861 |
unitsales int |
| 3862 |
) PARTITION BY RANGE (logdate);', |
| 3863 |
regexp => qr/^ |
| 3864 |
\Q-- Name: measurement;\E.*\n |
| 3865 |
\Q--\E\n\n |
| 3866 |
\QCREATE TABLE dump_test.measurement (\E\n |
| 3867 |
\s+\Qcity_id integer NOT NULL,\E\n |
| 3868 |
\s+\Qlogdate date NOT NULL,\E\n |
| 3869 |
\s+\Qpeaktemp integer,\E\n |
| 3870 |
\s+\Qunitsales integer,\E\n |
| 3871 |
\s+\QCONSTRAINT measurement_peaktemp_check CHECK ((peaktemp >= '-460'::integer))\E\n |
| 3872 |
\)\n |
| 3873 |
\QPARTITION BY RANGE (logdate);\E\n |
| 3874 |
/xm, |
| 3875 |
like => { |
| 3876 |
%full_runs, |
| 3877 |
%dump_test_schema_runs, |
| 3878 |
section_pre_data => 1, |
| 3879 |
only_dump_measurement => 1, |
| 3880 |
}, |
| 3881 |
unlike => { |
| 3882 |
binary_upgrade => 1, |
| 3883 |
exclude_dump_test_schema => 1, |
| 3884 |
exclude_measurement => 1, |
| 3885 |
}, |
| 3886 |
}, |
| 3887 |
|
| 3888 |
'Partition measurement_y2006m2 creation' => { |
| 3889 |
create_order => 91, |
| 3890 |
create_sql => |
| 3891 |
'CREATE TABLE dump_test_second_schema.measurement_y2006m2 |
| 3892 |
PARTITION OF dump_test.measurement ( |
| 3893 |
unitsales DEFAULT 0 CHECK (unitsales >= 0) |
| 3894 |
) |
| 3895 |
FOR VALUES FROM (\'2006-02-01\') TO (\'2006-03-01\');', |
| 3896 |
regexp => qr/^ |
| 3897 |
\QCREATE TABLE dump_test_second_schema.measurement_y2006m2 (\E\n |
| 3898 |
\s+\Qcity_id integer DEFAULT nextval('dump_test.measurement_city_id_seq'::regclass) CONSTRAINT measurement_city_id_not_null NOT NULL,\E\n |
| 3899 |
\s+\Qlogdate date CONSTRAINT measurement_logdate_not_null NOT NULL,\E\n |
| 3900 |
\s+\Qpeaktemp integer,\E\n |
| 3901 |
\s+\Qunitsales integer DEFAULT 0,\E\n |
| 3902 |
\s+\QCONSTRAINT measurement_peaktemp_check CHECK ((peaktemp >= '-460'::integer)),\E\n |
| 3903 |
\s+\QCONSTRAINT measurement_y2006m2_unitsales_check CHECK ((unitsales >= 0))\E\n |
| 3904 |
\);\n |
| 3905 |
/xm, |
| 3906 |
like => { |
| 3907 |
%full_runs, |
| 3908 |
section_pre_data => 1, |
| 3909 |
role => 1, |
| 3910 |
binary_upgrade => 1, |
| 3911 |
only_dump_measurement => 1, |
| 3912 |
}, |
| 3913 |
unlike => { |
| 3914 |
exclude_measurement => 1, |
| 3915 |
}, |
| 3916 |
}, |
| 3917 |
|
| 3918 |
'Creation of row-level trigger in partitioned table' => { |
| 3919 |
create_order => 92, |
| 3920 |
create_sql => 'CREATE TRIGGER test_trigger |
| 3921 |
AFTER INSERT ON dump_test.measurement |
| 3922 |
FOR EACH ROW EXECUTE PROCEDURE dump_test.trigger_func()', |
| 3923 |
regexp => qr/^ |
| 3924 |
\QCREATE TRIGGER test_trigger AFTER INSERT ON dump_test.measurement \E |
| 3925 |
\QFOR EACH ROW \E |
| 3926 |
\QEXECUTE FUNCTION dump_test.trigger_func();\E |
| 3927 |
/xm, |
| 3928 |
like => { |
| 3929 |
%full_runs, %dump_test_schema_runs, |
| 3930 |
section_post_data => 1, |
| 3931 |
only_dump_measurement => 1, |
| 3932 |
}, |
| 3933 |
unlike => { |
| 3934 |
exclude_dump_test_schema => 1, |
| 3935 |
exclude_measurement => 1, |
| 3936 |
}, |
| 3937 |
}, |
| 3938 |
|
| 3939 |
'COPY measurement' => { |
| 3940 |
create_order => 93, |
| 3941 |
create_sql => |
| 3942 |
'INSERT INTO dump_test.measurement (city_id, logdate, peaktemp, unitsales) ' |
| 3943 |
. "VALUES (1, '2006-02-12', 35, 1);", |
| 3944 |
regexp => qr/^ |
| 3945 |
\QCOPY dump_test_second_schema.measurement_y2006m2 (city_id, logdate, peaktemp, unitsales) FROM stdin;\E |
| 3946 |
\n(?:1\t2006-02-12\t35\t1\n)\\\.\n |
| 3947 |
/xm, |
| 3948 |
like => { |
| 3949 |
%full_runs, |
| 3950 |
%dump_test_schema_runs, |
| 3951 |
data_only => 1, |
| 3952 |
no_schema => 1, |
| 3953 |
only_dump_measurement => 1, |
| 3954 |
section_data => 1, |
| 3955 |
only_dump_test_schema => 1, |
| 3956 |
role_parallel => 1, |
| 3957 |
role => 1, |
| 3958 |
}, |
| 3959 |
unlike => { |
| 3960 |
binary_upgrade => 1, |
| 3961 |
schema_only => 1, |
| 3962 |
exclude_measurement => 1, |
| 3963 |
only_dump_test_schema => 1, |
| 3964 |
test_schema_plus_large_objects => 1, |
| 3965 |
exclude_measurement => 1, |
| 3966 |
exclude_measurement_data => 1, |
| 3967 |
}, |
| 3968 |
}, |
| 3969 |
|
| 3970 |
'Disabled trigger on partition is altered' => { |
| 3971 |
create_order => 93, |
| 3972 |
create_sql => |
| 3973 |
'CREATE TABLE dump_test_second_schema.measurement_y2006m3 |
| 3974 |
PARTITION OF dump_test.measurement |
| 3975 |
FOR VALUES FROM (\'2006-03-01\') TO (\'2006-04-01\'); |
| 3976 |
ALTER TABLE dump_test_second_schema.measurement_y2006m3 DISABLE TRIGGER test_trigger; |
| 3977 |
CREATE TABLE dump_test_second_schema.measurement_y2006m4 |
| 3978 |
PARTITION OF dump_test.measurement |
| 3979 |
FOR VALUES FROM (\'2006-04-01\') TO (\'2006-05-01\'); |
| 3980 |
ALTER TABLE dump_test_second_schema.measurement_y2006m4 ENABLE REPLICA TRIGGER test_trigger; |
| 3981 |
CREATE TABLE dump_test_second_schema.measurement_y2006m5 |
| 3982 |
PARTITION OF dump_test.measurement |
| 3983 |
FOR VALUES FROM (\'2006-05-01\') TO (\'2006-06-01\'); |
| 3984 |
ALTER TABLE dump_test_second_schema.measurement_y2006m5 ENABLE ALWAYS TRIGGER test_trigger; |
| 3985 |
', |
| 3986 |
regexp => qr/^ |
| 3987 |
\QALTER TABLE dump_test_second_schema.measurement_y2006m3 DISABLE TRIGGER test_trigger;\E |
| 3988 |
/xm, |
| 3989 |
like => { |
| 3990 |
%full_runs, |
| 3991 |
section_post_data => 1, |
| 3992 |
role => 1, |
| 3993 |
binary_upgrade => 1, |
| 3994 |
only_dump_measurement => 1, |
| 3995 |
}, |
| 3996 |
unlike => { |
| 3997 |
exclude_measurement => 1, |
| 3998 |
}, |
| 3999 |
}, |
| 4000 |
|
| 4001 |
'Replica trigger on partition is altered' => { |
| 4002 |
regexp => qr/^ |
| 4003 |
\QALTER TABLE dump_test_second_schema.measurement_y2006m4 ENABLE REPLICA TRIGGER test_trigger;\E |
| 4004 |
/xm, |
| 4005 |
like => { |
| 4006 |
%full_runs, |
| 4007 |
section_post_data => 1, |
| 4008 |
role => 1, |
| 4009 |
binary_upgrade => 1, |
| 4010 |
only_dump_measurement => 1, |
| 4011 |
}, |
| 4012 |
unlike => { |
| 4013 |
exclude_measurement => 1, |
| 4014 |
}, |
| 4015 |
}, |
| 4016 |
|
| 4017 |
'Always trigger on partition is altered' => { |
| 4018 |
regexp => qr/^ |
| 4019 |
\QALTER TABLE dump_test_second_schema.measurement_y2006m5 ENABLE ALWAYS TRIGGER test_trigger;\E |
| 4020 |
/xm, |
| 4021 |
like => { |
| 4022 |
%full_runs, |
| 4023 |
section_post_data => 1, |
| 4024 |
role => 1, |
| 4025 |
binary_upgrade => 1, |
| 4026 |
only_dump_measurement => 1, |
| 4027 |
}, |
| 4028 |
unlike => { |
| 4029 |
exclude_measurement => 1, |
| 4030 |
}, |
| 4031 |
}, |
| 4032 |
|
| 4033 |
# We should never see the creation of a trigger on a partition |
| 4034 |
'Disabled trigger on partition is not created' => { |
| 4035 |
regexp => qr/CREATE TRIGGER test_trigger.*ON dump_test_second_schema/, |
| 4036 |
like => {}, |
| 4037 |
}, |
| 4038 |
|
| 4039 |
# Triggers on partitions should not be dropped individually |
| 4040 |
'Triggers on partitions are not dropped' => { |
| 4041 |
regexp => qr/DROP TRIGGER test_trigger.*ON dump_test_second_schema/, |
| 4042 |
like => {} |
| 4043 |
}, |
| 4044 |
|
| 4045 |
'CREATE TABLE test_third_table_generated_cols' => { |
| 4046 |
create_order => 6, |
| 4047 |
create_sql => 'CREATE TABLE dump_test.test_third_table ( |
| 4048 |
f1 int, junk int, |
| 4049 |
g1 int generated always as (f1 * 2) stored, |
| 4050 |
"F3" int, |
| 4051 |
g2 int generated always as ("F3" * 3) stored |
| 4052 |
); |
| 4053 |
ALTER TABLE dump_test.test_third_table DROP COLUMN junk;', |
| 4054 |
regexp => qr/^ |
| 4055 |
\QCREATE TABLE dump_test.test_third_table (\E\n |
| 4056 |
\s+\Qf1 integer,\E\n |
| 4057 |
\s+\Qg1 integer GENERATED ALWAYS AS ((f1 * 2)) STORED,\E\n |
| 4058 |
\s+\Q"F3" integer,\E\n |
| 4059 |
\s+\Qg2 integer GENERATED ALWAYS AS (("F3" * 3)) STORED\E\n |
| 4060 |
\);\n |
| 4061 |
/xm, |
| 4062 |
like => |
| 4063 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4064 |
unlike => { |
| 4065 |
binary_upgrade => 1, |
| 4066 |
exclude_dump_test_schema => 1, |
| 4067 |
only_dump_measurement => 1, |
| 4068 |
}, |
| 4069 |
}, |
| 4070 |
|
| 4071 |
'CREATE TABLE test_fourth_table_zero_col' => { |
| 4072 |
create_order => 6, |
| 4073 |
create_sql => 'CREATE TABLE dump_test.test_fourth_table ( |
| 4074 |
);', |
| 4075 |
regexp => qr/^ |
| 4076 |
\QCREATE TABLE dump_test.test_fourth_table (\E |
| 4077 |
\n\); |
| 4078 |
/xm, |
| 4079 |
like => |
| 4080 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4081 |
unlike => { |
| 4082 |
exclude_dump_test_schema => 1, |
| 4083 |
only_dump_measurement => 1, |
| 4084 |
}, |
| 4085 |
}, |
| 4086 |
|
| 4087 |
'CREATE TABLE test_fifth_table' => { |
| 4088 |
create_order => 53, |
| 4089 |
create_sql => 'CREATE TABLE dump_test.test_fifth_table ( |
| 4090 |
col1 integer, |
| 4091 |
col2 boolean, |
| 4092 |
col3 boolean, |
| 4093 |
col4 bit(5), |
| 4094 |
col5 float8 |
| 4095 |
);', |
| 4096 |
regexp => qr/^ |
| 4097 |
\QCREATE TABLE dump_test.test_fifth_table (\E |
| 4098 |
\n\s+\Qcol1 integer,\E |
| 4099 |
\n\s+\Qcol2 boolean,\E |
| 4100 |
\n\s+\Qcol3 boolean,\E |
| 4101 |
\n\s+\Qcol4 bit(5),\E |
| 4102 |
\n\s+\Qcol5 double precision\E |
| 4103 |
\n\); |
| 4104 |
/xm, |
| 4105 |
like => |
| 4106 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4107 |
unlike => { |
| 4108 |
exclude_dump_test_schema => 1, |
| 4109 |
only_dump_measurement => 1, |
| 4110 |
}, |
| 4111 |
}, |
| 4112 |
|
| 4113 |
'CREATE TABLE test_sixth_table' => { |
| 4114 |
create_order => 6, |
| 4115 |
create_sql => 'CREATE TABLE dump_test.test_sixth_table ( |
| 4116 |
col1 int, |
| 4117 |
col2 text, |
| 4118 |
col3 bytea |
| 4119 |
);', |
| 4120 |
regexp => qr/^ |
| 4121 |
\QCREATE TABLE dump_test.test_sixth_table (\E |
| 4122 |
\n\s+\Qcol1 integer,\E |
| 4123 |
\n\s+\Qcol2 text,\E |
| 4124 |
\n\s+\Qcol3 bytea\E |
| 4125 |
\n\); |
| 4126 |
/xm, |
| 4127 |
like => |
| 4128 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4129 |
unlike => { |
| 4130 |
exclude_dump_test_schema => 1, |
| 4131 |
only_dump_measurement => 1, |
| 4132 |
}, |
| 4133 |
}, |
| 4134 |
|
| 4135 |
'CREATE TABLE test_seventh_table' => { |
| 4136 |
create_order => 6, |
| 4137 |
create_sql => 'CREATE TABLE dump_test.test_seventh_table ( |
| 4138 |
col1 int, |
| 4139 |
col2 text, |
| 4140 |
col3 bytea |
| 4141 |
);', |
| 4142 |
regexp => qr/^ |
| 4143 |
\QCREATE TABLE dump_test.test_seventh_table (\E |
| 4144 |
\n\s+\Qcol1 integer,\E |
| 4145 |
\n\s+\Qcol2 text,\E |
| 4146 |
\n\s+\Qcol3 bytea\E |
| 4147 |
\n\); |
| 4148 |
/xm, |
| 4149 |
like => |
| 4150 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4151 |
unlike => { |
| 4152 |
exclude_dump_test_schema => 1, |
| 4153 |
only_dump_measurement => 1, |
| 4154 |
}, |
| 4155 |
}, |
| 4156 |
|
| 4157 |
'CREATE TABLE test_table_identity' => { |
| 4158 |
create_order => 3, |
| 4159 |
create_sql => 'CREATE TABLE dump_test.test_table_identity ( |
| 4160 |
col1 int generated always as identity primary key, |
| 4161 |
col2 text |
| 4162 |
);', |
| 4163 |
regexp => qr/^ |
| 4164 |
\QCREATE TABLE dump_test.test_table_identity (\E\n |
| 4165 |
\s+\Qcol1 integer NOT NULL,\E\n |
| 4166 |
\s+\Qcol2 text\E\n |
| 4167 |
\); |
| 4168 |
.* |
| 4169 |
\QALTER TABLE dump_test.test_table_identity ALTER COLUMN col1 ADD GENERATED ALWAYS AS IDENTITY (\E\n |
| 4170 |
\s+\QSEQUENCE NAME dump_test.test_table_identity_col1_seq\E\n |
| 4171 |
\s+\QSTART WITH 1\E\n |
| 4172 |
\s+\QINCREMENT BY 1\E\n |
| 4173 |
\s+\QNO MINVALUE\E\n |
| 4174 |
\s+\QNO MAXVALUE\E\n |
| 4175 |
\s+\QCACHE 1\E\n |
| 4176 |
\); |
| 4177 |
/xms, |
| 4178 |
like => |
| 4179 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4180 |
unlike => { |
| 4181 |
exclude_dump_test_schema => 1, |
| 4182 |
only_dump_measurement => 1, |
| 4183 |
}, |
| 4184 |
}, |
| 4185 |
|
| 4186 |
'CREATE TABLE test_table_generated' => { |
| 4187 |
create_order => 3, |
| 4188 |
create_sql => 'CREATE TABLE dump_test.test_table_generated ( |
| 4189 |
col1 int primary key, |
| 4190 |
col2 int generated always as (col1 * 2) stored, |
| 4191 |
col3 int generated always as (col1 * 3) virtual |
| 4192 |
);', |
| 4193 |
regexp => qr/^ |
| 4194 |
\QCREATE TABLE dump_test.test_table_generated (\E\n |
| 4195 |
\s+\Qcol1 integer NOT NULL,\E\n |
| 4196 |
\s+\Qcol2 integer GENERATED ALWAYS AS ((col1 * 2)) STORED,\E\n |
| 4197 |
\s+\Qcol3 integer GENERATED ALWAYS AS ((col1 * 3))\E\n |
| 4198 |
\); |
| 4199 |
/xms, |
| 4200 |
like => |
| 4201 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4202 |
unlike => { |
| 4203 |
exclude_dump_test_schema => 1, |
| 4204 |
only_dump_measurement => 1, |
| 4205 |
}, |
| 4206 |
}, |
| 4207 |
|
| 4208 |
'CREATE TABLE test_table_generated_child1 (without local columns)' => { |
| 4209 |
create_order => 4, |
| 4210 |
create_sql => 'CREATE TABLE dump_test.test_table_generated_child1 () |
| 4211 |
INHERITS (dump_test.test_table_generated);', |
| 4212 |
regexp => qr/^ |
| 4213 |
\QCREATE TABLE dump_test.test_table_generated_child1 (\E\n |
| 4214 |
\)\n |
| 4215 |
\QINHERITS (dump_test.test_table_generated);\E\n |
| 4216 |
/xms, |
| 4217 |
like => |
| 4218 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4219 |
unlike => { |
| 4220 |
binary_upgrade => 1, |
| 4221 |
exclude_dump_test_schema => 1, |
| 4222 |
only_dump_measurement => 1, |
| 4223 |
}, |
| 4224 |
}, |
| 4225 |
|
| 4226 |
'ALTER TABLE test_table_generated_child1' => { |
| 4227 |
regexp => |
| 4228 |
qr/^\QALTER TABLE ONLY dump_test.test_table_generated_child1 ALTER COLUMN col2 \E/m, |
| 4229 |
|
| 4230 |
# should not get emitted |
| 4231 |
like => {}, |
| 4232 |
}, |
| 4233 |
|
| 4234 |
'CREATE TABLE test_table_generated_child2 (with local columns)' => { |
| 4235 |
create_order => 4, |
| 4236 |
create_sql => 'CREATE TABLE dump_test.test_table_generated_child2 ( |
| 4237 |
col1 int, |
| 4238 |
col2 int |
| 4239 |
) INHERITS (dump_test.test_table_generated);', |
| 4240 |
regexp => qr/^ |
| 4241 |
\QCREATE TABLE dump_test.test_table_generated_child2 (\E\n |
| 4242 |
\s+\Qcol1 integer,\E\n |
| 4243 |
\s+\Qcol2 integer\E\n |
| 4244 |
\)\n |
| 4245 |
\QINHERITS (dump_test.test_table_generated);\E\n |
| 4246 |
/xms, |
| 4247 |
like => |
| 4248 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4249 |
unlike => { |
| 4250 |
binary_upgrade => 1, |
| 4251 |
exclude_dump_test_schema => 1, |
| 4252 |
only_dump_measurement => 1, |
| 4253 |
}, |
| 4254 |
}, |
| 4255 |
|
| 4256 |
'CREATE TABLE table_with_stats' => { |
| 4257 |
create_order => 98, |
| 4258 |
create_sql => 'CREATE TABLE dump_test.table_index_stats ( |
| 4259 |
col1 int, |
| 4260 |
col2 int, |
| 4261 |
col3 int); |
| 4262 |
CREATE INDEX index_with_stats |
| 4263 |
ON dump_test.table_index_stats |
| 4264 |
((col1 + 1), col1, (col2 + 1), (col3 + 1)); |
| 4265 |
ALTER INDEX dump_test.index_with_stats |
| 4266 |
ALTER COLUMN 1 SET STATISTICS 400; |
| 4267 |
ALTER INDEX dump_test.index_with_stats |
| 4268 |
ALTER COLUMN 3 SET STATISTICS 500;', |
| 4269 |
regexp => qr/^ |
| 4270 |
\QALTER INDEX dump_test.index_with_stats ALTER COLUMN 1 SET STATISTICS 400;\E\n |
| 4271 |
\QALTER INDEX dump_test.index_with_stats ALTER COLUMN 3 SET STATISTICS 500;\E\n |
| 4272 |
/xms, |
| 4273 |
like => |
| 4274 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 4275 |
unlike => { |
| 4276 |
exclude_dump_test_schema => 1, |
| 4277 |
only_dump_measurement => 1, |
| 4278 |
}, |
| 4279 |
}, |
| 4280 |
|
| 4281 |
'CREATE TABLE test_inheritance_parent' => { |
| 4282 |
create_order => 90, |
| 4283 |
create_sql => 'CREATE TABLE dump_test.test_inheritance_parent ( |
| 4284 |
col1 int NOT NULL, |
| 4285 |
col2 int CHECK (col2 >= 42) |
| 4286 |
);', |
| 4287 |
regexp => qr/^ |
| 4288 |
\QCREATE TABLE dump_test.test_inheritance_parent (\E\n |
| 4289 |
\s+\Qcol1 integer NOT NULL,\E\n |
| 4290 |
\s+\Qcol2 integer,\E\n |
| 4291 |
\s+\QCONSTRAINT test_inheritance_parent_col2_check CHECK ((col2 >= 42))\E\n |
| 4292 |
\Q);\E\n |
| 4293 |
/xm, |
| 4294 |
like => |
| 4295 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4296 |
unlike => { |
| 4297 |
exclude_dump_test_schema => 1, |
| 4298 |
only_dump_measurement => 1, |
| 4299 |
}, |
| 4300 |
}, |
| 4301 |
|
| 4302 |
'CREATE TABLE test_inheritance_child' => { |
| 4303 |
create_order => 91, |
| 4304 |
create_sql => 'CREATE TABLE dump_test.test_inheritance_child ( |
| 4305 |
col1 int NOT NULL, |
| 4306 |
CONSTRAINT test_inheritance_child CHECK (col2 >= 142857) |
| 4307 |
) INHERITS (dump_test.test_inheritance_parent);', |
| 4308 |
regexp => qr/^ |
| 4309 |
\QCREATE TABLE dump_test.test_inheritance_child (\E\n |
| 4310 |
\s+\Qcol1 integer NOT NULL,\E\n |
| 4311 |
\s+\QCONSTRAINT test_inheritance_child CHECK ((col2 >= 142857))\E\n |
| 4312 |
\)\n |
| 4313 |
\QINHERITS (dump_test.test_inheritance_parent);\E\n |
| 4314 |
/xm, |
| 4315 |
like => { |
| 4316 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 4317 |
}, |
| 4318 |
unlike => { |
| 4319 |
binary_upgrade => 1, |
| 4320 |
exclude_dump_test_schema => 1, |
| 4321 |
only_dump_measurement => 1, |
| 4322 |
}, |
| 4323 |
}, |
| 4324 |
|
| 4325 |
'CREATE STATISTICS extended_stats_no_options' => { |
| 4326 |
create_order => 97, |
| 4327 |
create_sql => 'CREATE STATISTICS dump_test.test_ext_stats_no_options |
| 4328 |
ON col1, col2 FROM dump_test.test_table', |
| 4329 |
regexp => qr/^ |
| 4330 |
\QCREATE STATISTICS dump_test.test_ext_stats_no_options ON col1, col2 FROM dump_test.test_table;\E |
| 4331 |
/xms, |
| 4332 |
like => |
| 4333 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 4334 |
unlike => { |
| 4335 |
exclude_dump_test_schema => 1, |
| 4336 |
exclude_test_table => 1, |
| 4337 |
only_dump_measurement => 1, |
| 4338 |
}, |
| 4339 |
}, |
| 4340 |
|
| 4341 |
'CREATE STATISTICS extended_stats_options' => { |
| 4342 |
create_order => 97, |
| 4343 |
create_sql => 'CREATE STATISTICS dump_test.test_ext_stats_opts |
| 4344 |
(ndistinct) ON col1, col2 FROM dump_test.test_fifth_table', |
| 4345 |
regexp => qr/^ |
| 4346 |
\QCREATE STATISTICS dump_test.test_ext_stats_opts (ndistinct) ON col1, col2 FROM dump_test.test_fifth_table;\E |
| 4347 |
/xms, |
| 4348 |
like => |
| 4349 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 4350 |
unlike => { |
| 4351 |
exclude_dump_test_schema => 1, |
| 4352 |
only_dump_measurement => 1, |
| 4353 |
}, |
| 4354 |
}, |
| 4355 |
|
| 4356 |
'ALTER STATISTICS extended_stats_options' => { |
| 4357 |
create_order => 98, |
| 4358 |
create_sql => |
| 4359 |
'ALTER STATISTICS dump_test.test_ext_stats_opts SET STATISTICS 1000', |
| 4360 |
regexp => qr/^ |
| 4361 |
\QALTER STATISTICS dump_test.test_ext_stats_opts SET STATISTICS 1000;\E |
| 4362 |
/xms, |
| 4363 |
like => |
| 4364 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 4365 |
unlike => { |
| 4366 |
exclude_dump_test_schema => 1, |
| 4367 |
only_dump_measurement => 1, |
| 4368 |
}, |
| 4369 |
}, |
| 4370 |
|
| 4371 |
'CREATE STATISTICS extended_stats_expression' => { |
| 4372 |
create_order => 99, |
| 4373 |
create_sql => 'CREATE STATISTICS dump_test.test_ext_stats_expr |
| 4374 |
ON (2 * col1) FROM dump_test.test_fifth_table', |
| 4375 |
regexp => qr/^ |
| 4376 |
\QCREATE STATISTICS dump_test.test_ext_stats_expr ON (2 * col1) FROM dump_test.test_fifth_table;\E |
| 4377 |
/xms, |
| 4378 |
like => |
| 4379 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 4380 |
unlike => { |
| 4381 |
exclude_dump_test_schema => 1, |
| 4382 |
only_dump_measurement => 1, |
| 4383 |
}, |
| 4384 |
}, |
| 4385 |
|
| 4386 |
'CREATE SEQUENCE test_table_col1_seq' => { |
| 4387 |
regexp => qr/^ |
| 4388 |
\QCREATE SEQUENCE dump_test.test_table_col1_seq\E |
| 4389 |
\n\s+\QAS integer\E |
| 4390 |
\n\s+\QSTART WITH 1\E |
| 4391 |
\n\s+\QINCREMENT BY 1\E |
| 4392 |
\n\s+\QNO MINVALUE\E |
| 4393 |
\n\s+\QNO MAXVALUE\E |
| 4394 |
\n\s+\QCACHE 1;\E |
| 4395 |
/xm, |
| 4396 |
like => { |
| 4397 |
%full_runs, |
| 4398 |
%dump_test_schema_runs, |
| 4399 |
only_dump_test_table => 1, |
| 4400 |
section_pre_data => 1, |
| 4401 |
}, |
| 4402 |
unlike => { |
| 4403 |
exclude_dump_test_schema => 1, |
| 4404 |
only_dump_measurement => 1, |
| 4405 |
}, |
| 4406 |
}, |
| 4407 |
|
| 4408 |
'CREATE INDEX ON ONLY measurement' => { |
| 4409 |
create_order => 92, |
| 4410 |
create_sql => |
| 4411 |
'CREATE INDEX ON dump_test.measurement (city_id, logdate);', |
| 4412 |
regexp => qr/^ |
| 4413 |
\QCREATE INDEX measurement_city_id_logdate_idx ON ONLY dump_test.measurement USING\E |
| 4414 |
/xm, |
| 4415 |
like => { |
| 4416 |
%full_runs, %dump_test_schema_runs, section_post_data => 1, |
| 4417 |
}, |
| 4418 |
unlike => { |
| 4419 |
exclude_dump_test_schema => 1, |
| 4420 |
exclude_measurement => 1, |
| 4421 |
}, |
| 4422 |
}, |
| 4423 |
|
| 4424 |
'ALTER TABLE measurement PRIMARY KEY' => { |
| 4425 |
catch_all => 'CREATE ... commands', |
| 4426 |
create_order => 93, |
| 4427 |
create_sql => |
| 4428 |
'ALTER TABLE dump_test.measurement ADD PRIMARY KEY (city_id, logdate);', |
| 4429 |
regexp => qr/^ |
| 4430 |
\QALTER TABLE ONLY dump_test.measurement\E \n^\s+ |
| 4431 |
\QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E |
| 4432 |
/xm, |
| 4433 |
like => { |
| 4434 |
%full_runs, |
| 4435 |
%dump_test_schema_runs, |
| 4436 |
section_post_data => 1, |
| 4437 |
only_dump_measurement => 1, |
| 4438 |
}, |
| 4439 |
unlike => { |
| 4440 |
exclude_dump_test_schema => 1, |
| 4441 |
exclude_measurement => 1, |
| 4442 |
}, |
| 4443 |
}, |
| 4444 |
|
| 4445 |
'CREATE INDEX ... ON measurement_y2006_m2' => { |
| 4446 |
regexp => qr/^ |
| 4447 |
\QCREATE INDEX measurement_y2006m2_city_id_logdate_idx ON dump_test_second_schema.measurement_y2006m2 \E |
| 4448 |
/xm, |
| 4449 |
like => { |
| 4450 |
%full_runs, |
| 4451 |
role => 1, |
| 4452 |
section_post_data => 1, |
| 4453 |
only_dump_measurement => 1, |
| 4454 |
}, |
| 4455 |
unlike => { |
| 4456 |
exclude_measurement => 1, |
| 4457 |
}, |
| 4458 |
}, |
| 4459 |
|
| 4460 |
'ALTER INDEX ... ATTACH PARTITION' => { |
| 4461 |
regexp => qr/^ |
| 4462 |
\QALTER INDEX dump_test.measurement_city_id_logdate_idx ATTACH PARTITION dump_test_second_schema.measurement_y2006m2_city_id_logdate_idx\E |
| 4463 |
/xm, |
| 4464 |
like => { |
| 4465 |
%full_runs, |
| 4466 |
role => 1, |
| 4467 |
section_post_data => 1, |
| 4468 |
only_dump_measurement => 1, |
| 4469 |
}, |
| 4470 |
unlike => { |
| 4471 |
exclude_measurement => 1, |
| 4472 |
}, |
| 4473 |
}, |
| 4474 |
|
| 4475 |
'ALTER INDEX ... ATTACH PARTITION (primary key)' => { |
| 4476 |
catch_all => 'CREATE ... commands', |
| 4477 |
regexp => qr/^ |
| 4478 |
\QALTER INDEX dump_test.measurement_pkey ATTACH PARTITION dump_test_second_schema.measurement_y2006m2_pkey\E |
| 4479 |
/xm, |
| 4480 |
like => { |
| 4481 |
%full_runs, |
| 4482 |
role => 1, |
| 4483 |
section_post_data => 1, |
| 4484 |
only_dump_measurement => 1, |
| 4485 |
}, |
| 4486 |
unlike => { |
| 4487 |
exclude_measurement => 1, |
| 4488 |
}, |
| 4489 |
}, |
| 4490 |
|
| 4491 |
'CREATE VIEW test_view' => { |
| 4492 |
create_order => 61, |
| 4493 |
create_sql => 'CREATE VIEW dump_test.test_view |
| 4494 |
WITH (check_option = \'local\', security_barrier = true) AS |
| 4495 |
SELECT col1 FROM dump_test.test_table;', |
| 4496 |
regexp => qr/^ |
| 4497 |
\QCREATE VIEW dump_test.test_view WITH (security_barrier='true') AS\E |
| 4498 |
\n\s+\QSELECT col1\E |
| 4499 |
\n\s+\QFROM dump_test.test_table\E |
| 4500 |
\n\s+\QWITH LOCAL CHECK OPTION;\E/xm, |
| 4501 |
like => |
| 4502 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4503 |
unlike => { |
| 4504 |
exclude_dump_test_schema => 1, |
| 4505 |
only_dump_measurement => 1, |
| 4506 |
}, |
| 4507 |
}, |
| 4508 |
|
| 4509 |
'ALTER VIEW test_view SET DEFAULT' => { |
| 4510 |
create_order => 62, |
| 4511 |
create_sql => |
| 4512 |
'ALTER VIEW dump_test.test_view ALTER COLUMN col1 SET DEFAULT 1;', |
| 4513 |
regexp => qr/^ |
| 4514 |
\QALTER TABLE ONLY dump_test.test_view ALTER COLUMN col1 SET DEFAULT 1;\E/xm, |
| 4515 |
like => |
| 4516 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4517 |
unlike => { |
| 4518 |
exclude_dump_test_schema => 1, |
| 4519 |
only_dump_measurement => 1, |
| 4520 |
}, |
| 4521 |
}, |
| 4522 |
|
| 4523 |
# FIXME |
| 4524 |
'DROP SCHEMA public (for testing without public schema)' => { |
| 4525 |
database => 'regress_pg_dump_test', |
| 4526 |
create_order => 100, |
| 4527 |
create_sql => 'DROP SCHEMA public;', |
| 4528 |
regexp => qr/^DROP SCHEMA public;/m, |
| 4529 |
like => {}, |
| 4530 |
}, |
| 4531 |
|
| 4532 |
'DROP SCHEMA public' => { |
| 4533 |
regexp => qr/^DROP SCHEMA public;/m, |
| 4534 |
|
| 4535 |
# this shouldn't ever get emitted anymore |
| 4536 |
like => {}, |
| 4537 |
}, |
| 4538 |
|
| 4539 |
'DROP SCHEMA IF EXISTS public' => { |
| 4540 |
regexp => qr/^DROP SCHEMA IF EXISTS public;/m, |
| 4541 |
|
| 4542 |
# this shouldn't ever get emitted anymore |
| 4543 |
like => {}, |
| 4544 |
}, |
| 4545 |
|
| 4546 |
'DROP EXTENSION plpgsql' => { |
| 4547 |
regexp => qr/^DROP EXTENSION plpgsql;/m, |
| 4548 |
|
| 4549 |
# this shouldn't ever get emitted anymore |
| 4550 |
like => {}, |
| 4551 |
}, |
| 4552 |
|
| 4553 |
'DROP FUNCTION dump_test.pltestlang_call_handler()' => { |
| 4554 |
regexp => qr/^DROP FUNCTION dump_test\.pltestlang_call_handler\(\);/m, |
| 4555 |
like => { clean => 1, }, |
| 4556 |
}, |
| 4557 |
|
| 4558 |
'DROP LANGUAGE pltestlang' => { |
| 4559 |
regexp => qr/^DROP PROCEDURAL LANGUAGE pltestlang;/m, |
| 4560 |
like => { clean => 1, }, |
| 4561 |
}, |
| 4562 |
|
| 4563 |
'DROP SCHEMA dump_test' => { |
| 4564 |
regexp => qr/^DROP SCHEMA dump_test;/m, |
| 4565 |
like => { clean => 1, }, |
| 4566 |
}, |
| 4567 |
|
| 4568 |
'DROP SCHEMA dump_test_second_schema' => { |
| 4569 |
regexp => qr/^DROP SCHEMA dump_test_second_schema;/m, |
| 4570 |
like => { clean => 1, }, |
| 4571 |
}, |
| 4572 |
|
| 4573 |
'DROP TABLE test_table' => { |
| 4574 |
regexp => qr/^DROP TABLE dump_test\.test_table;/m, |
| 4575 |
like => { clean => 1, }, |
| 4576 |
}, |
| 4577 |
|
| 4578 |
'DROP TABLE fk_reference_test_table' => { |
| 4579 |
regexp => qr/^DROP TABLE dump_test\.fk_reference_test_table;/m, |
| 4580 |
like => { clean => 1, }, |
| 4581 |
}, |
| 4582 |
|
| 4583 |
'DROP TABLE test_second_table' => { |
| 4584 |
regexp => qr/^DROP TABLE dump_test\.test_second_table;/m, |
| 4585 |
like => { clean => 1, }, |
| 4586 |
}, |
| 4587 |
|
| 4588 |
'DROP EXTENSION IF EXISTS plpgsql' => { |
| 4589 |
regexp => qr/^DROP EXTENSION IF EXISTS plpgsql;/m, |
| 4590 |
|
| 4591 |
# this shouldn't ever get emitted anymore |
| 4592 |
like => {}, |
| 4593 |
}, |
| 4594 |
|
| 4595 |
'DROP FUNCTION IF EXISTS dump_test.pltestlang_call_handler()' => { |
| 4596 |
regexp => qr/^ |
| 4597 |
\QDROP FUNCTION IF EXISTS dump_test.pltestlang_call_handler();\E |
| 4598 |
/xm, |
| 4599 |
like => { clean_if_exists => 1, }, |
| 4600 |
}, |
| 4601 |
|
| 4602 |
'DROP LANGUAGE IF EXISTS pltestlang' => { |
| 4603 |
regexp => qr/^DROP PROCEDURAL LANGUAGE IF EXISTS pltestlang;/m, |
| 4604 |
like => { clean_if_exists => 1, }, |
| 4605 |
}, |
| 4606 |
|
| 4607 |
'DROP SCHEMA IF EXISTS dump_test' => { |
| 4608 |
regexp => qr/^DROP SCHEMA IF EXISTS dump_test;/m, |
| 4609 |
like => { clean_if_exists => 1, }, |
| 4610 |
}, |
| 4611 |
|
| 4612 |
'DROP SCHEMA IF EXISTS dump_test_second_schema' => { |
| 4613 |
regexp => qr/^DROP SCHEMA IF EXISTS dump_test_second_schema;/m, |
| 4614 |
like => { clean_if_exists => 1, }, |
| 4615 |
}, |
| 4616 |
|
| 4617 |
'DROP TABLE IF EXISTS test_table' => { |
| 4618 |
regexp => qr/^DROP TABLE IF EXISTS dump_test\.test_table;/m, |
| 4619 |
like => { clean_if_exists => 1, }, |
| 4620 |
}, |
| 4621 |
|
| 4622 |
'DROP TABLE IF EXISTS test_second_table' => { |
| 4623 |
regexp => qr/^DROP TABLE IF EXISTS dump_test\.test_second_table;/m, |
| 4624 |
like => { clean_if_exists => 1, }, |
| 4625 |
}, |
| 4626 |
|
| 4627 |
'DROP ROLE regress_dump_test_role' => { |
| 4628 |
regexp => qr/^ |
| 4629 |
\QDROP ROLE regress_dump_test_role;\E |
| 4630 |
/xm, |
| 4631 |
like => { pg_dumpall_globals_clean => 1, }, |
| 4632 |
}, |
| 4633 |
|
| 4634 |
'DROP ROLE pg_' => { |
| 4635 |
regexp => qr/^ |
| 4636 |
\QDROP ROLE pg_\E.+; |
| 4637 |
/xm, |
| 4638 |
|
| 4639 |
# this shouldn't ever get emitted anywhere |
| 4640 |
like => {}, |
| 4641 |
}, |
| 4642 |
|
| 4643 |
'GRANT USAGE ON SCHEMA dump_test_second_schema' => { |
| 4644 |
create_order => 10, |
| 4645 |
create_sql => 'GRANT USAGE ON SCHEMA dump_test_second_schema |
| 4646 |
TO regress_dump_test_role;', |
| 4647 |
regexp => qr/^ |
| 4648 |
\QGRANT USAGE ON SCHEMA dump_test_second_schema TO regress_dump_test_role;\E |
| 4649 |
/xm, |
| 4650 |
like => { |
| 4651 |
%full_runs, |
| 4652 |
role => 1, |
| 4653 |
section_pre_data => 1, |
| 4654 |
}, |
| 4655 |
unlike => { no_privs => 1, }, |
| 4656 |
}, |
| 4657 |
|
| 4658 |
'GRANT USAGE ON FOREIGN DATA WRAPPER dummy' => { |
| 4659 |
create_order => 85, |
| 4660 |
create_sql => 'GRANT USAGE ON FOREIGN DATA WRAPPER dummy |
| 4661 |
TO regress_dump_test_role;', |
| 4662 |
regexp => qr/^ |
| 4663 |
\QGRANT ALL ON FOREIGN DATA WRAPPER dummy TO regress_dump_test_role;\E |
| 4664 |
/xm, |
| 4665 |
like => { %full_runs, section_pre_data => 1, }, |
| 4666 |
unlike => { no_privs => 1, }, |
| 4667 |
}, |
| 4668 |
|
| 4669 |
'GRANT USAGE ON FOREIGN SERVER s1' => { |
| 4670 |
create_order => 85, |
| 4671 |
create_sql => 'GRANT USAGE ON FOREIGN SERVER s1 |
| 4672 |
TO regress_dump_test_role;', |
| 4673 |
regexp => qr/^ |
| 4674 |
\QGRANT ALL ON FOREIGN SERVER s1 TO regress_dump_test_role;\E |
| 4675 |
/xm, |
| 4676 |
like => { %full_runs, section_pre_data => 1, }, |
| 4677 |
unlike => { no_privs => 1, }, |
| 4678 |
}, |
| 4679 |
|
| 4680 |
'GRANT USAGE ON DOMAIN dump_test.us_postal_code' => { |
| 4681 |
create_order => 72, |
| 4682 |
create_sql => |
| 4683 |
'GRANT USAGE ON DOMAIN dump_test.us_postal_code TO regress_dump_test_role;', |
| 4684 |
regexp => qr/^ |
| 4685 |
\QGRANT ALL ON TYPE dump_test.us_postal_code TO regress_dump_test_role;\E |
| 4686 |
/xm, |
| 4687 |
like => |
| 4688 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4689 |
unlike => { |
| 4690 |
exclude_dump_test_schema => 1, |
| 4691 |
no_privs => 1, |
| 4692 |
only_dump_measurement => 1, |
| 4693 |
}, |
| 4694 |
}, |
| 4695 |
|
| 4696 |
'GRANT USAGE ON TYPE dump_test.int42' => { |
| 4697 |
create_order => 87, |
| 4698 |
create_sql => |
| 4699 |
'GRANT USAGE ON TYPE dump_test.int42 TO regress_dump_test_role;', |
| 4700 |
regexp => qr/^ |
| 4701 |
\QGRANT ALL ON TYPE dump_test.int42 TO regress_dump_test_role;\E |
| 4702 |
/xm, |
| 4703 |
like => |
| 4704 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4705 |
unlike => { |
| 4706 |
exclude_dump_test_schema => 1, |
| 4707 |
no_privs => 1, |
| 4708 |
only_dump_measurement => 1, |
| 4709 |
}, |
| 4710 |
}, |
| 4711 |
|
| 4712 |
'GRANT USAGE ON TYPE dump_test.planets - ENUM' => { |
| 4713 |
create_order => 66, |
| 4714 |
create_sql => |
| 4715 |
'GRANT USAGE ON TYPE dump_test.planets TO regress_dump_test_role;', |
| 4716 |
regexp => qr/^ |
| 4717 |
\QGRANT ALL ON TYPE dump_test.planets TO regress_dump_test_role;\E |
| 4718 |
/xm, |
| 4719 |
like => |
| 4720 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4721 |
unlike => { |
| 4722 |
exclude_dump_test_schema => 1, |
| 4723 |
no_privs => 1, |
| 4724 |
only_dump_measurement => 1, |
| 4725 |
}, |
| 4726 |
}, |
| 4727 |
|
| 4728 |
'GRANT USAGE ON TYPE dump_test.textrange - RANGE' => { |
| 4729 |
create_order => 67, |
| 4730 |
create_sql => |
| 4731 |
'GRANT USAGE ON TYPE dump_test.textrange TO regress_dump_test_role;', |
| 4732 |
regexp => qr/^ |
| 4733 |
\QGRANT ALL ON TYPE dump_test.textrange TO regress_dump_test_role;\E |
| 4734 |
/xm, |
| 4735 |
like => |
| 4736 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4737 |
unlike => { |
| 4738 |
exclude_dump_test_schema => 1, |
| 4739 |
no_privs => 1, |
| 4740 |
only_dump_measurement => 1, |
| 4741 |
}, |
| 4742 |
}, |
| 4743 |
|
| 4744 |
'GRANT CREATE ON DATABASE dump_test' => { |
| 4745 |
create_order => 48, |
| 4746 |
create_sql => |
| 4747 |
'GRANT CREATE ON DATABASE dump_test TO regress_dump_test_role;', |
| 4748 |
regexp => qr/^ |
| 4749 |
\QGRANT CREATE ON DATABASE dump_test TO regress_dump_test_role;\E |
| 4750 |
/xm, |
| 4751 |
like => { pg_dumpall_dbprivs => 1, }, |
| 4752 |
}, |
| 4753 |
|
| 4754 |
'GRANT SELECT ON TABLE test_table' => { |
| 4755 |
create_order => 5, |
| 4756 |
create_sql => 'GRANT SELECT ON TABLE dump_test.test_table |
| 4757 |
TO regress_dump_test_role;', |
| 4758 |
regexp => |
| 4759 |
qr/^\QGRANT SELECT ON TABLE dump_test.test_table TO regress_dump_test_role;\E/m, |
| 4760 |
like => { |
| 4761 |
%full_runs, |
| 4762 |
%dump_test_schema_runs, |
| 4763 |
only_dump_test_table => 1, |
| 4764 |
section_pre_data => 1, |
| 4765 |
}, |
| 4766 |
unlike => { |
| 4767 |
exclude_dump_test_schema => 1, |
| 4768 |
exclude_test_table => 1, |
| 4769 |
no_privs => 1, |
| 4770 |
only_dump_measurement => 1, |
| 4771 |
}, |
| 4772 |
}, |
| 4773 |
|
| 4774 |
'GRANT SELECT ON TABLE measurement' => { |
| 4775 |
create_order => 91, |
| 4776 |
create_sql => 'GRANT SELECT ON TABLE dump_test.measurement |
| 4777 |
TO regress_dump_test_role; |
| 4778 |
GRANT SELECT(city_id) ON TABLE dump_test.measurement |
| 4779 |
TO "regress_quoted \"" role";', |
| 4780 |
regexp => |
| 4781 |
qr/^\QGRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;\E\n.* |
| 4782 |
^\QGRANT SELECT(city_id) ON TABLE dump_test.measurement TO "regress_quoted \"" role";\E/xms, |
| 4783 |
like => { |
| 4784 |
%full_runs, |
| 4785 |
%dump_test_schema_runs, |
| 4786 |
section_pre_data => 1, |
| 4787 |
only_dump_measurement => 1, |
| 4788 |
}, |
| 4789 |
unlike => { |
| 4790 |
exclude_dump_test_schema => 1, |
| 4791 |
no_privs => 1, |
| 4792 |
exclude_measurement => 1, |
| 4793 |
}, |
| 4794 |
}, |
| 4795 |
|
| 4796 |
'GRANT SELECT ON TABLE measurement_y2006m2' => { |
| 4797 |
create_order => 94, |
| 4798 |
create_sql => 'GRANT SELECT ON TABLE |
| 4799 |
dump_test_second_schema.measurement_y2006m2, |
| 4800 |
dump_test_second_schema.measurement_y2006m3, |
| 4801 |
dump_test_second_schema.measurement_y2006m4, |
| 4802 |
dump_test_second_schema.measurement_y2006m5 |
| 4803 |
TO regress_dump_test_role;', |
| 4804 |
regexp => |
| 4805 |
qr/^\QGRANT SELECT ON TABLE dump_test_second_schema.measurement_y2006m2 TO regress_dump_test_role;\E/m, |
| 4806 |
like => { |
| 4807 |
%full_runs, |
| 4808 |
role => 1, |
| 4809 |
section_pre_data => 1, |
| 4810 |
only_dump_measurement => 1, |
| 4811 |
}, |
| 4812 |
unlike => { |
| 4813 |
no_privs => 1, |
| 4814 |
exclude_measurement => 1, |
| 4815 |
}, |
| 4816 |
}, |
| 4817 |
|
| 4818 |
'GRANT ALL ON LARGE OBJECT ...' => { |
| 4819 |
create_order => 60, |
| 4820 |
create_sql => 'DO $$ |
| 4821 |
DECLARE myoid oid; |
| 4822 |
BEGIN |
| 4823 |
SELECT loid FROM pg_largeobject INTO myoid; |
| 4824 |
EXECUTE \'GRANT ALL ON LARGE OBJECT \' || myoid || \' TO regress_dump_test_role;\'; |
| 4825 |
END; |
| 4826 |
$$;', |
| 4827 |
regexp => qr/^ |
| 4828 |
\QGRANT ALL ON LARGE OBJECT \E[0-9]+\Q TO regress_dump_test_role;\E |
| 4829 |
/xm, |
| 4830 |
like => { |
| 4831 |
%full_runs, |
| 4832 |
column_inserts => 1, |
| 4833 |
data_only => 1, |
| 4834 |
inserts => 1, |
| 4835 |
no_schema => 1, |
| 4836 |
section_data => 1, |
| 4837 |
test_schema_plus_large_objects => 1, |
| 4838 |
binary_upgrade => 1, |
| 4839 |
}, |
| 4840 |
unlike => { |
| 4841 |
no_large_objects => 1, |
| 4842 |
no_privs => 1, |
| 4843 |
schema_only => 1, |
| 4844 |
}, |
| 4845 |
}, |
| 4846 |
|
| 4847 |
'GRANT INSERT(col1) ON TABLE test_second_table' => { |
| 4848 |
create_order => 8, |
| 4849 |
create_sql => |
| 4850 |
'GRANT INSERT (col1) ON TABLE dump_test.test_second_table |
| 4851 |
TO regress_dump_test_role;', |
| 4852 |
regexp => qr/^ |
| 4853 |
\QGRANT INSERT(col1) ON TABLE dump_test.test_second_table TO regress_dump_test_role;\E |
| 4854 |
/xm, |
| 4855 |
like => |
| 4856 |
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, |
| 4857 |
unlike => { |
| 4858 |
exclude_dump_test_schema => 1, |
| 4859 |
no_privs => 1, |
| 4860 |
only_dump_measurement => 1, |
| 4861 |
}, |
| 4862 |
}, |
| 4863 |
|
| 4864 |
'GRANT EXECUTE ON FUNCTION pg_sleep() TO regress_dump_test_role' => { |
| 4865 |
create_order => 16, |
| 4866 |
create_sql => 'GRANT EXECUTE ON FUNCTION pg_sleep(float8) |
| 4867 |
TO regress_dump_test_role;', |
| 4868 |
regexp => qr/^ |
| 4869 |
\QGRANT ALL ON FUNCTION pg_catalog.pg_sleep(double precision) TO regress_dump_test_role;\E |
| 4870 |
/xm, |
| 4871 |
like => { %full_runs, section_pre_data => 1, }, |
| 4872 |
unlike => { no_privs => 1, }, |
| 4873 |
}, |
| 4874 |
|
| 4875 |
'GRANT SELECT (proname ...) ON TABLE pg_proc TO public' => { |
| 4876 |
create_order => 46, |
| 4877 |
create_sql => 'GRANT SELECT ( |
| 4878 |
tableoid, |
| 4879 |
oid, |
| 4880 |
proname, |
| 4881 |
pronamespace, |
| 4882 |
proowner, |
| 4883 |
prolang, |
| 4884 |
procost, |
| 4885 |
prorows, |
| 4886 |
provariadic, |
| 4887 |
prosupport, |
| 4888 |
prokind, |
| 4889 |
prosecdef, |
| 4890 |
proleakproof, |
| 4891 |
proisstrict, |
| 4892 |
proretset, |
| 4893 |
provolatile, |
| 4894 |
proparallel, |
| 4895 |
pronargs, |
| 4896 |
pronargdefaults, |
| 4897 |
prorettype, |
| 4898 |
proargtypes, |
| 4899 |
proallargtypes, |
| 4900 |
proargmodes, |
| 4901 |
proargnames, |
| 4902 |
proargdefaults, |
| 4903 |
protrftypes, |
| 4904 |
prosrc, |
| 4905 |
probin, |
| 4906 |
proconfig, |
| 4907 |
proacl |
| 4908 |
) ON TABLE pg_proc TO public;', |
| 4909 |
regexp => qr/ |
| 4910 |
\QGRANT SELECT(tableoid) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4911 |
\QGRANT SELECT(oid) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4912 |
\QGRANT SELECT(proname) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4913 |
\QGRANT SELECT(pronamespace) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4914 |
\QGRANT SELECT(proowner) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4915 |
\QGRANT SELECT(prolang) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4916 |
\QGRANT SELECT(procost) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4917 |
\QGRANT SELECT(prorows) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4918 |
\QGRANT SELECT(provariadic) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4919 |
\QGRANT SELECT(prosupport) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4920 |
\QGRANT SELECT(prokind) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4921 |
\QGRANT SELECT(prosecdef) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4922 |
\QGRANT SELECT(proleakproof) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4923 |
\QGRANT SELECT(proisstrict) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4924 |
\QGRANT SELECT(proretset) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4925 |
\QGRANT SELECT(provolatile) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4926 |
\QGRANT SELECT(proparallel) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4927 |
\QGRANT SELECT(pronargs) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4928 |
\QGRANT SELECT(pronargdefaults) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4929 |
\QGRANT SELECT(prorettype) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4930 |
\QGRANT SELECT(proargtypes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4931 |
\QGRANT SELECT(proallargtypes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4932 |
\QGRANT SELECT(proargmodes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4933 |
\QGRANT SELECT(proargnames) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4934 |
\QGRANT SELECT(proargdefaults) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4935 |
\QGRANT SELECT(protrftypes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4936 |
\QGRANT SELECT(prosrc) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4937 |
\QGRANT SELECT(probin) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4938 |
\QGRANT SELECT(proconfig) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.* |
| 4939 |
\QGRANT SELECT(proacl) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E/xms, |
| 4940 |
like => { %full_runs, section_pre_data => 1, }, |
| 4941 |
unlike => { no_privs => 1, }, |
| 4942 |
}, |
| 4943 |
|
| 4944 |
'GRANT USAGE ON SCHEMA public TO public' => { |
| 4945 |
regexp => qr/^ |
| 4946 |
\Q--\E\n\n |
| 4947 |
\QGRANT USAGE ON SCHEMA public TO PUBLIC;\E |
| 4948 |
/xm, |
| 4949 |
|
| 4950 |
# this shouldn't ever get emitted anymore |
| 4951 |
like => {}, |
| 4952 |
}, |
| 4953 |
|
| 4954 |
'REFRESH MATERIALIZED VIEW matview' => { |
| 4955 |
regexp => qr/^\QREFRESH MATERIALIZED VIEW dump_test.matview;\E/m, |
| 4956 |
like => |
| 4957 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 4958 |
unlike => { |
| 4959 |
binary_upgrade => 1, |
| 4960 |
exclude_dump_test_schema => 1, |
| 4961 |
schema_only => 1, |
| 4962 |
only_dump_measurement => 1, |
| 4963 |
}, |
| 4964 |
}, |
| 4965 |
|
| 4966 |
'REFRESH MATERIALIZED VIEW matview_second' => { |
| 4967 |
regexp => qr/^ |
| 4968 |
\QREFRESH MATERIALIZED VIEW dump_test.matview;\E |
| 4969 |
\n.* |
| 4970 |
\QREFRESH MATERIALIZED VIEW dump_test.matview_second;\E |
| 4971 |
/xms, |
| 4972 |
like => |
| 4973 |
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, }, |
| 4974 |
unlike => { |
| 4975 |
binary_upgrade => 1, |
| 4976 |
exclude_dump_test_schema => 1, |
| 4977 |
schema_only => 1, |
| 4978 |
only_dump_measurement => 1, |
| 4979 |
}, |
| 4980 |
}, |
| 4981 |
|
| 4982 |
# FIXME |
| 4983 |
'REFRESH MATERIALIZED VIEW matview_third' => { |
| 4984 |
regexp => qr/^ |
| 4985 |
\QREFRESH MATERIALIZED VIEW dump_test.matview_third;\E |
| 4986 |
/xms, |
| 4987 |
like => {}, |
| 4988 |
}, |
| 4989 |
|
| 4990 |
# FIXME |
| 4991 |
'REFRESH MATERIALIZED VIEW matview_fourth' => { |
| 4992 |
regexp => qr/^ |
| 4993 |
\QREFRESH MATERIALIZED VIEW dump_test.matview_fourth;\E |
| 4994 |
/xms, |
| 4995 |
like => {}, |
| 4996 |
}, |
| 4997 |
|
| 4998 |
'REVOKE CONNECT ON DATABASE dump_test FROM public' => { |
| 4999 |
create_order => 49, |
| 5000 |
create_sql => 'REVOKE CONNECT ON DATABASE dump_test FROM public;', |
| 5001 |
regexp => qr/^ |
| 5002 |
\QREVOKE CONNECT,TEMPORARY ON DATABASE dump_test FROM PUBLIC;\E\n |
| 5003 |
\QGRANT TEMPORARY ON DATABASE dump_test TO PUBLIC;\E\n |
| 5004 |
\QGRANT CREATE ON DATABASE dump_test TO regress_dump_test_role;\E |
| 5005 |
/xm, |
| 5006 |
like => { pg_dumpall_dbprivs => 1, }, |
| 5007 |
}, |
| 5008 |
|
| 5009 |
'REVOKE EXECUTE ON FUNCTION pg_sleep() FROM public' => { |
| 5010 |
create_order => 15, |
| 5011 |
create_sql => 'REVOKE EXECUTE ON FUNCTION pg_sleep(float8) |
| 5012 |
FROM public;', |
| 5013 |
regexp => qr/^ |
| 5014 |
\QREVOKE ALL ON FUNCTION pg_catalog.pg_sleep(double precision) FROM PUBLIC;\E |
| 5015 |
/xm, |
| 5016 |
like => { %full_runs, section_pre_data => 1, }, |
| 5017 |
unlike => { no_privs => 1, }, |
| 5018 |
}, |
| 5019 |
|
| 5020 |
# With the exception of the public schema, we don't dump ownership changes |
| 5021 |
# for objects originating at initdb. Hence, any GRANT or REVOKE affecting |
| 5022 |
# owner privileges for those objects should reference the bootstrap |
| 5023 |
# superuser, not the dump-time owner. |
| 5024 |
'REVOKE EXECUTE ON FUNCTION pg_stat_reset FROM regress_dump_test_role' => |
| 5025 |
{ |
| 5026 |
create_order => 15, |
| 5027 |
create_sql => ' |
| 5028 |
ALTER FUNCTION pg_stat_reset OWNER TO regress_dump_test_role; |
| 5029 |
REVOKE EXECUTE ON FUNCTION pg_stat_reset |
| 5030 |
FROM regress_dump_test_role;', |
| 5031 |
regexp => qr/^[^-].*pg_stat_reset.* regress_dump_test_role/m, |
| 5032 |
|
| 5033 |
# this shouldn't ever get emitted |
| 5034 |
like => {}, |
| 5035 |
}, |
| 5036 |
|
| 5037 |
'REVOKE SELECT ON TABLE pg_proc FROM public' => { |
| 5038 |
create_order => 45, |
| 5039 |
create_sql => 'REVOKE SELECT ON TABLE pg_proc FROM public;', |
| 5040 |
regexp => |
| 5041 |
qr/^\QREVOKE SELECT ON TABLE pg_catalog.pg_proc FROM PUBLIC;\E/m, |
| 5042 |
like => { %full_runs, section_pre_data => 1, }, |
| 5043 |
unlike => { no_privs => 1, }, |
| 5044 |
}, |
| 5045 |
|
| 5046 |
'REVOKE ALL ON SCHEMA public' => { |
| 5047 |
create_order => 16, |
| 5048 |
create_sql => |
| 5049 |
'REVOKE ALL ON SCHEMA public FROM "regress_quoted \"" role";', |
| 5050 |
regexp => |
| 5051 |
qr/^REVOKE ALL ON SCHEMA public FROM "regress_quoted \\"" role";/m, |
| 5052 |
like => { %full_runs, section_pre_data => 1, }, |
| 5053 |
unlike => { no_privs => 1, }, |
| 5054 |
}, |
| 5055 |
|
| 5056 |
'REVOKE USAGE ON LANGUAGE plpgsql FROM public' => { |
| 5057 |
create_order => 16, |
| 5058 |
create_sql => 'REVOKE USAGE ON LANGUAGE plpgsql FROM public;', |
| 5059 |
regexp => qr/^REVOKE ALL ON LANGUAGE plpgsql FROM PUBLIC;/m, |
| 5060 |
like => { |
| 5061 |
%full_runs, |
| 5062 |
%dump_test_schema_runs, |
| 5063 |
only_dump_test_table => 1, |
| 5064 |
role => 1, |
| 5065 |
section_pre_data => 1, |
| 5066 |
only_dump_measurement => 1, |
| 5067 |
}, |
| 5068 |
unlike => { no_privs => 1, }, |
| 5069 |
}, |
| 5070 |
|
| 5071 |
|
| 5072 |
'CREATE ACCESS METHOD regress_test_table_am' => { |
| 5073 |
create_order => 11, |
| 5074 |
create_sql => |
| 5075 |
'CREATE ACCESS METHOD regress_table_am TYPE TABLE HANDLER heap_tableam_handler;', |
| 5076 |
regexp => qr/^ |
| 5077 |
\QCREATE ACCESS METHOD regress_table_am TYPE TABLE HANDLER heap_tableam_handler;\E |
| 5078 |
\n/xm, |
| 5079 |
like => { |
| 5080 |
%full_runs, section_pre_data => 1, |
| 5081 |
}, |
| 5082 |
}, |
| 5083 |
|
| 5084 |
# It's a bit tricky to ensure that the proper SET of default table |
| 5085 |
# AM occurs. To achieve that we create a table with the standard |
| 5086 |
# AM, test AM, standard AM. That guarantees that there needs to be |
| 5087 |
# a SET interspersed. Then use a regex that prevents interspersed |
| 5088 |
# SET ...; statements, followed by the expected CREATE TABLE. Not |
| 5089 |
# pretty, but seems hard to do better in this framework. |
| 5090 |
'CREATE TABLE regress_pg_dump_table_am' => { |
| 5091 |
create_order => 12, |
| 5092 |
create_sql => ' |
| 5093 |
CREATE TABLE dump_test.regress_pg_dump_table_am_0() USING heap; |
| 5094 |
CREATE TABLE dump_test.regress_pg_dump_table_am_1 (col1 int) USING regress_table_am; |
| 5095 |
CREATE TABLE dump_test.regress_pg_dump_table_am_2() USING heap;', |
| 5096 |
regexp => qr/^ |
| 5097 |
\QSET default_table_access_method = regress_table_am;\E |
| 5098 |
(\n(?!SET[^;]+;)[^\n]*)* |
| 5099 |
\n\QCREATE TABLE dump_test.regress_pg_dump_table_am_1 (\E |
| 5100 |
\n\s+\Qcol1 integer\E |
| 5101 |
\n\);/xm, |
| 5102 |
like => { |
| 5103 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 5104 |
}, |
| 5105 |
unlike => { |
| 5106 |
exclude_dump_test_schema => 1, |
| 5107 |
no_table_access_method => 1, |
| 5108 |
only_dump_measurement => 1, |
| 5109 |
}, |
| 5110 |
}, |
| 5111 |
|
| 5112 |
'CREATE MATERIALIZED VIEW regress_pg_dump_matview_am' => { |
| 5113 |
create_order => 13, |
| 5114 |
create_sql => ' |
| 5115 |
CREATE MATERIALIZED VIEW dump_test.regress_pg_dump_matview_am_0 USING heap AS SELECT 1; |
| 5116 |
CREATE MATERIALIZED VIEW dump_test.regress_pg_dump_matview_am_1 |
| 5117 |
USING regress_table_am AS SELECT count(*) FROM pg_class; |
| 5118 |
CREATE MATERIALIZED VIEW dump_test.regress_pg_dump_matview_am_2 USING heap AS SELECT 1;', |
| 5119 |
regexp => qr/^ |
| 5120 |
\QSET default_table_access_method = regress_table_am;\E |
| 5121 |
(\n(?!SET[^;]+;)[^\n]*)* |
| 5122 |
\QCREATE MATERIALIZED VIEW dump_test.regress_pg_dump_matview_am_1 AS\E |
| 5123 |
\n\s+\QSELECT count(*) AS count\E |
| 5124 |
\n\s+\QFROM pg_class\E |
| 5125 |
\n\s+\QWITH NO DATA;\E\n/xm, |
| 5126 |
like => { |
| 5127 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 5128 |
}, |
| 5129 |
unlike => { |
| 5130 |
exclude_dump_test_schema => 1, |
| 5131 |
no_table_access_method => 1, |
| 5132 |
only_dump_measurement => 1, |
| 5133 |
}, |
| 5134 |
}, |
| 5135 |
|
| 5136 |
# |
| 5137 |
# TABLE and MATVIEW stats will end up in SECTION_DATA. |
| 5138 |
# INDEX stats (expression columns only) will end up in SECTION_POST_DATA. |
| 5139 |
# |
| 5140 |
'statistics_import' => { |
| 5141 |
create_sql => ' |
| 5142 |
CREATE TABLE dump_test.has_stats |
| 5143 |
AS SELECT g.g AS x, g.g / 2 AS y FROM generate_series(1,100) AS g(g); |
| 5144 |
CREATE MATERIALIZED VIEW dump_test.has_stats_mv AS SELECT * FROM dump_test.has_stats; |
| 5145 |
CREATE INDEX """dump_test""\'s post-data index" ON dump_test.has_stats(x, (x - 1)); |
| 5146 |
ANALYZE dump_test.has_stats, dump_test.has_stats_mv;', |
| 5147 |
regexp => qr/^ |
| 5148 |
\QSELECT * FROM pg_catalog.pg_restore_relation_stats(\E\s+ |
| 5149 |
'version',\s'\d+'::integer,\s+ |
| 5150 |
'schemaname',\s'dump_test',\s+ |
| 5151 |
'relname',\s'"dump_test"''s\ post-data\ index',\s+ |
| 5152 |
'relpages',\s'\d+'::integer,\s+ |
| 5153 |
'reltuples',\s'\d+'::real,\s+ |
| 5154 |
'relallvisible',\s'\d+'::integer,\s+ |
| 5155 |
'relallfrozen',\s'\d+'::integer\s+ |
| 5156 |
\);\s+ |
| 5157 |
\QSELECT * FROM pg_catalog.pg_restore_attribute_stats(\E\s+ |
| 5158 |
'version',\s'\d+'::integer,\s+ |
| 5159 |
'schemaname',\s'dump_test',\s+ |
| 5160 |
'relname',\s'"dump_test"''s\ post-data\ index',\s+ |
| 5161 |
'attnum',\s'2'::smallint,\s+ |
| 5162 |
'inherited',\s'f'::boolean,\s+ |
| 5163 |
'null_frac',\s'0'::real,\s+ |
| 5164 |
'avg_width',\s'4'::integer,\s+ |
| 5165 |
'n_distinct',\s'-1'::real,\s+ |
| 5166 |
'histogram_bounds',\s'\{[0-9,]+\}'::text,\s+ |
| 5167 |
'correlation',\s'1'::real\s+ |
| 5168 |
\);/xm, |
| 5169 |
like => { |
| 5170 |
%full_runs, |
| 5171 |
%dump_test_schema_runs, |
| 5172 |
no_data_no_schema => 1, |
| 5173 |
no_schema => 1, |
| 5174 |
section_post_data => 1, |
| 5175 |
statistics_only => 1, |
| 5176 |
statistics_only_with_schema => 1, |
| 5177 |
statistics_only_with_index => 1, |
| 5178 |
}, |
| 5179 |
unlike => { |
| 5180 |
exclude_dump_test_schema => 1, |
| 5181 |
no_statistics => 1, |
| 5182 |
only_dump_measurement => 1, |
| 5183 |
schema_only => 1, |
| 5184 |
}, |
| 5185 |
}, |
| 5186 |
|
| 5187 |
# |
| 5188 |
# While attribute stats (aka pg_statistic stats) only appear for tables |
| 5189 |
# that have been analyzed, all tables will have relation stats because |
| 5190 |
# those come from pg_class. |
| 5191 |
# |
| 5192 |
'relstats_on_unanalyzed_tables' => { |
| 5193 |
regexp => qr/pg_catalog.pg_restore_relation_stats/, |
| 5194 |
|
| 5195 |
like => { |
| 5196 |
%full_runs, |
| 5197 |
%dump_test_schema_runs, |
| 5198 |
no_data_no_schema => 1, |
| 5199 |
no_schema => 1, |
| 5200 |
only_dump_test_table => 1, |
| 5201 |
role => 1, |
| 5202 |
role_parallel => 1, |
| 5203 |
section_data => 1, |
| 5204 |
section_post_data => 1, |
| 5205 |
statistics_only => 1, |
| 5206 |
statistics_only_with_schema => 1, |
| 5207 |
statistics_only_with_index => 1, |
| 5208 |
statistics_only_with_table => 1, |
| 5209 |
}, |
| 5210 |
unlike => { |
| 5211 |
no_statistics => 1, |
| 5212 |
schema_only => 1, |
| 5213 |
}, |
| 5214 |
}, |
| 5215 |
|
| 5216 |
# CREATE TABLE with partitioned table and various AMs. One |
| 5217 |
# partition uses the same default as the parent, and a second |
| 5218 |
# uses its own AM. |
| 5219 |
'CREATE TABLE regress_pg_dump_table_part' => { |
| 5220 |
create_order => 19, |
| 5221 |
create_sql => ' |
| 5222 |
CREATE TABLE dump_test.regress_pg_dump_table_am_parent (id int) PARTITION BY LIST (id); |
| 5223 |
ALTER TABLE dump_test.regress_pg_dump_table_am_parent SET ACCESS METHOD regress_table_am; |
| 5224 |
CREATE TABLE dump_test.regress_pg_dump_table_am_child_1 |
| 5225 |
PARTITION OF dump_test.regress_pg_dump_table_am_parent FOR VALUES IN (1); |
| 5226 |
CREATE TABLE dump_test.regress_pg_dump_table_am_child_2 |
| 5227 |
PARTITION OF dump_test.regress_pg_dump_table_am_parent FOR VALUES IN (2) USING heap;', |
| 5228 |
regexp => qr/^ |
| 5229 |
\n\QCREATE TABLE dump_test.regress_pg_dump_table_am_parent (\E |
| 5230 |
(\n(?!SET[^;]+;)[^\n]*)* |
| 5231 |
\QALTER TABLE dump_test.regress_pg_dump_table_am_parent SET ACCESS METHOD regress_table_am;\E |
| 5232 |
(.*\n)* |
| 5233 |
\QSET default_table_access_method = regress_table_am;\E |
| 5234 |
(\n(?!SET[^;]+;)[^\n]*)* |
| 5235 |
\n\QCREATE TABLE dump_test.regress_pg_dump_table_am_child_1 (\E |
| 5236 |
(.*\n)* |
| 5237 |
\QSET default_table_access_method = heap;\E |
| 5238 |
(\n(?!SET[^;]+;)[^\n]*)* |
| 5239 |
\n\QCREATE TABLE dump_test.regress_pg_dump_table_am_child_2 (\E |
| 5240 |
(.*\n)*/xm, |
| 5241 |
like => { |
| 5242 |
%full_runs, %dump_test_schema_runs, section_pre_data => 1, |
| 5243 |
}, |
| 5244 |
unlike => { |
| 5245 |
exclude_dump_test_schema => 1, |
| 5246 |
no_table_access_method => 1, |
| 5247 |
only_dump_measurement => 1, |
| 5248 |
}, |
| 5249 |
}); |
| 5250 |
|
| 5251 |
######################################### |
| 5252 |
# Create a PG instance to test actually dumping from |
| 5253 |
|
| 5254 |
my $node = PostgreSQL::Test::Cluster->new('main'); |
| 5255 |
$node->init; |
| 5256 |
$node->start; |
| 5257 |
|
| 5258 |
my $port = $node->port; |
| 5259 |
|
| 5260 |
# We need to see if this system supports CREATE COLLATION or not |
| 5261 |
# If it doesn't then we will skip all the COLLATION-related tests. |
| 5262 |
my $collation_support = 0; |
| 5263 |
my $collation_check_stderr; |
| 5264 |
$node->psql( |
| 5265 |
'postgres', |
| 5266 |
"CREATE COLLATION testing FROM \"C\"; DROP COLLATION testing;", |
| 5267 |
on_error_stop => 0, |
| 5268 |
stderr => \$collation_check_stderr); |
| 5269 |
|
| 5270 |
if ($collation_check_stderr !~ /ERROR: /) |
| 5271 |
{ |
| 5272 |
$collation_support = 1; |
| 5273 |
} |
| 5274 |
|
| 5275 |
# ICU doesn't work with some encodings |
| 5276 |
my $encoding = $node->safe_psql('postgres', 'show server_encoding'); |
| 5277 |
$supports_icu = 0 if $encoding eq 'SQL_ASCII'; |
| 5278 |
|
| 5279 |
# Create additional databases for mutations of schema public |
| 5280 |
$node->psql('postgres', 'create database regress_pg_dump_test;'); |
| 5281 |
$node->psql('postgres', 'create database regress_public_owner;'); |
| 5282 |
|
| 5283 |
######################################### |
| 5284 |
# Set up schemas, tables, etc, to be dumped. |
| 5285 |
|
| 5286 |
# Build up the create statements |
| 5287 |
my %create_sql = (); |
| 5288 |
|
| 5289 |
foreach my $test ( |
| 5290 |
sort { |
| 5291 |
if ($tests{$a}->{create_order} and $tests{$b}->{create_order}) |
| 5292 |
{ |
| 5293 |
$tests{$a}->{create_order} <=> $tests{$b}->{create_order}; |
| 5294 |
} |
| 5295 |
elsif ($tests{$a}->{create_order}) |
| 5296 |
{ |
| 5297 |
-1; |
| 5298 |
} |
| 5299 |
elsif ($tests{$b}->{create_order}) |
| 5300 |
{ |
| 5301 |
1; |
| 5302 |
} |
| 5303 |
else |
| 5304 |
{ |
| 5305 |
0; |
| 5306 |
} |
| 5307 |
} keys %tests) |
| 5308 |
{ |
| 5309 |
my $test_db = 'postgres'; |
| 5310 |
|
| 5311 |
if (defined($tests{$test}->{database})) |
| 5312 |
{ |
| 5313 |
$test_db = $tests{$test}->{database}; |
| 5314 |
} |
| 5315 |
|
| 5316 |
if (defined($tests{$test}->{icu})) |
| 5317 |
{ |
| 5318 |
$tests{$test}->{collation} = 1; |
| 5319 |
} |
| 5320 |
|
| 5321 |
if ($tests{$test}->{create_sql}) |
| 5322 |
{ |
| 5323 |
|
| 5324 |
# Skip any collation-related commands if there is no collation support |
| 5325 |
if (!$collation_support && defined($tests{$test}->{collation})) |
| 5326 |
{ |
| 5327 |
next; |
| 5328 |
} |
| 5329 |
|
| 5330 |
# Skip any icu-related collation commands if build was without icu |
| 5331 |
if (!$supports_icu && defined($tests{$test}->{icu})) |
| 5332 |
{ |
| 5333 |
next; |
| 5334 |
} |
| 5335 |
|
| 5336 |
# Skip tests specific to LZ4 if this build does not support |
| 5337 |
# this option. |
| 5338 |
if (!$supports_lz4 && defined($tests{$test}->{lz4})) |
| 5339 |
{ |
| 5340 |
next; |
| 5341 |
} |
| 5342 |
|
| 5343 |
# Normalize command ending: strip all line endings, add |
| 5344 |
# semicolon if missing, add two newlines. |
| 5345 |
my $create_sql = $tests{$test}->{create_sql}; |
| 5346 |
chomp $create_sql; |
| 5347 |
$create_sql .= ';' unless substr($create_sql, -1) eq ';'; |
| 5348 |
$create_sql{$test_db} .= $create_sql . "\n\n"; |
| 5349 |
} |
| 5350 |
} |
| 5351 |
|
| 5352 |
# Send the combined set of commands to psql |
| 5353 |
foreach my $db (sort keys %create_sql) |
| 5354 |
{ |
| 5355 |
$node->safe_psql($db, $create_sql{$db}); |
| 5356 |
} |
| 5357 |
|
| 5358 |
######################################### |
| 5359 |
# Test connecting to a non-existent database |
| 5360 |
|
| 5361 |
command_fails_like( |
| 5362 |
[ 'pg_dump', '--port' => $port, 'qqq' ], |
| 5363 |
qr/pg_dump: error: connection to server .* failed: FATAL: database "qqq" does not exist/, |
| 5364 |
'connecting to a non-existent database'); |
| 5365 |
|
| 5366 |
######################################### |
| 5367 |
# Test connecting to an invalid database |
| 5368 |
|
| 5369 |
$node->command_fails_like( |
| 5370 |
[ 'pg_dump', '--dbname' => 'regression_invalid' ], |
| 5371 |
qr/pg_dump: error: connection to server .* failed: FATAL: cannot connect to invalid database "regression_invalid"/, |
| 5372 |
'connecting to an invalid database'); |
| 5373 |
|
| 5374 |
######################################### |
| 5375 |
# Test connecting with an unprivileged user |
| 5376 |
|
| 5377 |
command_fails_like( |
| 5378 |
[ 'pg_dump', '--port' => $port, '--role' => 'regress_dump_test_role' ], |
| 5379 |
qr/\Qpg_dump: error: query failed: ERROR: permission denied for\E/, |
| 5380 |
'connecting with an unprivileged user'); |
| 5381 |
|
| 5382 |
######################################### |
| 5383 |
# Test dumping a non-existent schema, table, and patterns with --strict-names |
| 5384 |
|
| 5385 |
command_fails_like( |
| 5386 |
[ 'pg_dump', '--port' => $port, '--schema' => 'nonexistent' ], |
| 5387 |
qr/\Qpg_dump: error: no matching schemas were found\E/, |
| 5388 |
'dumping a non-existent schema'); |
| 5389 |
|
| 5390 |
command_fails_like( |
| 5391 |
[ 'pg_dump', '--port' => $port, '--table' => 'nonexistent' ], |
| 5392 |
qr/\Qpg_dump: error: no matching tables were found\E/, |
| 5393 |
'dumping a non-existent table'); |
| 5394 |
|
| 5395 |
command_fails_like( |
| 5396 |
[ |
| 5397 |
'pg_dump', |
| 5398 |
'--port' => $port, |
| 5399 |
'--strict-names', |
| 5400 |
'--schema' => 'nonexistent*' |
| 5401 |
], |
| 5402 |
qr/\Qpg_dump: error: no matching schemas were found for pattern\E/, |
| 5403 |
'no matching schemas'); |
| 5404 |
|
| 5405 |
command_fails_like( |
| 5406 |
[ |
| 5407 |
'pg_dump', |
| 5408 |
'--port' => $port, |
| 5409 |
'--strict-names', |
| 5410 |
'--schema-only', |
| 5411 |
'--statistics', |
| 5412 |
], |
| 5413 |
qr/\Qpg_dump: error: options -s\/--schema-only and --statistics cannot be used together\E/, |
| 5414 |
'cannot use --schema-only and --statistics together'); |
| 5415 |
|
| 5416 |
command_fails_like( |
| 5417 |
[ |
| 5418 |
'pg_dump', |
| 5419 |
'--port' => $port, |
| 5420 |
'--strict-names', |
| 5421 |
'--table' => 'nonexistent*' |
| 5422 |
], |
| 5423 |
qr/\Qpg_dump: error: no matching tables were found for pattern\E/, |
| 5424 |
'no matching tables'); |
| 5425 |
|
| 5426 |
######################################### |
| 5427 |
# Test invalid multipart database names |
| 5428 |
|
| 5429 |
$node->command_fails_like( |
| 5430 |
[ 'pg_dumpall', '--exclude-database' => '.' ], |
| 5431 |
qr/pg_dumpall: error: improper qualified name \(too many dotted names\): \./, |
| 5432 |
'pg_dumpall: option --exclude-database rejects multipart pattern "."'); |
| 5433 |
|
| 5434 |
$node->command_fails_like( |
| 5435 |
[ 'pg_dumpall', '--exclude-database' => 'myhost.mydb' ], |
| 5436 |
qr/pg_dumpall: error: improper qualified name \(too many dotted names\): myhost\.mydb/, |
| 5437 |
'pg_dumpall: option --exclude-database rejects multipart database names'); |
| 5438 |
|
| 5439 |
############################################################## |
| 5440 |
# Test dumping pg_catalog (for research -- cannot be reloaded) |
| 5441 |
|
| 5442 |
$node->command_ok( |
| 5443 |
[ |
| 5444 |
'pg_dump', |
| 5445 |
'--port' => $port, |
| 5446 |
'--schema' => 'pg_catalog', |
| 5447 |
'--file' => "$tempdir/pgdump_pgcatalog.dmp" |
| 5448 |
], |
| 5449 |
'pg_dump: option -n pg_catalog'); |
| 5450 |
|
| 5451 |
######################################### |
| 5452 |
# Test valid database exclusion patterns |
| 5453 |
|
| 5454 |
$node->command_ok( |
| 5455 |
[ |
| 5456 |
'pg_dumpall', |
| 5457 |
'--port' => $port, |
| 5458 |
'--exclude-database' => '"myhost.mydb"', |
| 5459 |
'--file' => "$tempdir/pgdumpall.dmp" |
| 5460 |
], |
| 5461 |
'pg_dumpall: option --exclude-database handles database names with embedded dots' |
| 5462 |
); |
| 5463 |
|
| 5464 |
######################################### |
| 5465 |
# Test invalid multipart schema names |
| 5466 |
|
| 5467 |
$node->command_fails_like( |
| 5468 |
[ 'pg_dump', '--schema' => 'myhost.mydb.myschema' ], |
| 5469 |
qr/pg_dump: error: improper qualified name \(too many dotted names\): myhost\.mydb\.myschema/, |
| 5470 |
'pg_dump: option --schema rejects three-part schema names'); |
| 5471 |
|
| 5472 |
$node->command_fails_like( |
| 5473 |
[ 'pg_dump', '--schema' => 'otherdb.myschema' ], |
| 5474 |
qr/pg_dump: error: cross-database references are not implemented: otherdb\.myschema/, |
| 5475 |
'pg_dump: option --schema rejects cross-database multipart schema names'); |
| 5476 |
|
| 5477 |
$node->command_fails_like( |
| 5478 |
[ 'pg_dump', '--schema' => '.' ], |
| 5479 |
qr/pg_dump: error: cross-database references are not implemented: \./, |
| 5480 |
'pg_dump: option --schema rejects degenerate two-part schema name: "."'); |
| 5481 |
|
| 5482 |
$node->command_fails_like( |
| 5483 |
[ 'pg_dump', '--schema' => '"some.other.db".myschema' ], |
| 5484 |
qr/pg_dump: error: cross-database references are not implemented: "some\.other\.db"\.myschema/, |
| 5485 |
'pg_dump: option --schema rejects cross-database multipart schema names with embedded dots' |
| 5486 |
); |
| 5487 |
|
| 5488 |
$node->command_fails_like( |
| 5489 |
[ 'pg_dump', '--schema' => '..' ], |
| 5490 |
qr/pg_dump: error: improper qualified name \(too many dotted names\): \.\./, |
| 5491 |
'pg_dump: option --schema rejects degenerate three-part schema name: ".."' |
| 5492 |
); |
| 5493 |
|
| 5494 |
######################################### |
| 5495 |
# Test invalid multipart relation names |
| 5496 |
|
| 5497 |
$node->command_fails_like( |
| 5498 |
[ 'pg_dump', '--table' => 'myhost.mydb.myschema.mytable' ], |
| 5499 |
qr/pg_dump: error: improper relation name \(too many dotted names\): myhost\.mydb\.myschema\.mytable/, |
| 5500 |
'pg_dump: option --table rejects four-part table names'); |
| 5501 |
|
| 5502 |
$node->command_fails_like( |
| 5503 |
[ 'pg_dump', '--table' => 'otherdb.pg_catalog.pg_class' ], |
| 5504 |
qr/pg_dump: error: cross-database references are not implemented: otherdb\.pg_catalog\.pg_class/, |
| 5505 |
'pg_dump: option --table rejects cross-database three part table names'); |
| 5506 |
|
| 5507 |
command_fails_like( |
| 5508 |
[ |
| 5509 |
'pg_dump', |
| 5510 |
'--port' => $port, |
| 5511 |
'--table' => '"some.other.db".pg_catalog.pg_class' |
| 5512 |
], |
| 5513 |
qr/pg_dump: error: cross-database references are not implemented: "some\.other\.db"\.pg_catalog\.pg_class/, |
| 5514 |
'pg_dump: option --table rejects cross-database three part table names with embedded dots' |
| 5515 |
); |
| 5516 |
|
| 5517 |
######################################### |
| 5518 |
# Run all runs |
| 5519 |
|
| 5520 |
foreach my $run (sort keys %pgdump_runs) |
| 5521 |
{ |
| 5522 |
my $test_key = $run; |
| 5523 |
my $run_db = 'postgres'; |
| 5524 |
|
| 5525 |
# Skip command-level tests for gzip/lz4/zstd if the tool is not supported |
| 5526 |
if ($pgdump_runs{$run}->{compile_option} |
| 5527 |
&& (($pgdump_runs{$run}->{compile_option} eq 'gzip' |
| 5528 |
&& !$supports_gzip) |
| 5529 |
|| ($pgdump_runs{$run}->{compile_option} eq 'lz4' |
| 5530 |
&& !$supports_lz4) |
| 5531 |
|| ($pgdump_runs{$run}->{compile_option} eq 'zstd' |
| 5532 |
&& !$supports_zstd))) |
| 5533 |
{ |
| 5534 |
note |
| 5535 |
"$run: skipped due to no $pgdump_runs{$run}->{compile_option} support"; |
| 5536 |
next; |
| 5537 |
} |
| 5538 |
|
| 5539 |
$node->command_ok(\@{ $pgdump_runs{$run}->{dump_cmd} }, |
| 5540 |
"$run: pg_dump runs"); |
| 5541 |
|
| 5542 |
if ($pgdump_runs{$run}->{compress_cmd}) |
| 5543 |
{ |
| 5544 |
my ($compress_cmd) = $pgdump_runs{$run}->{compress_cmd}; |
| 5545 |
my $compress_program = $compress_cmd->{program}; |
| 5546 |
|
| 5547 |
# Skip the rest of the test if the compression program is |
| 5548 |
# not defined. |
| 5549 |
next if (!defined($compress_program) || $compress_program eq ''); |
| 5550 |
|
| 5551 |
# Arguments may require globbing. |
| 5552 |
my @full_compress_cmd = ($compress_program); |
| 5553 |
foreach my $arg (@{ $compress_cmd->{args} }) |
| 5554 |
{ |
| 5555 |
push @full_compress_cmd, glob($arg); |
| 5556 |
} |
| 5557 |
|
| 5558 |
command_ok(\@full_compress_cmd, "$run: compression commands"); |
| 5559 |
} |
| 5560 |
|
| 5561 |
if ($pgdump_runs{$run}->{glob_patterns}) |
| 5562 |
{ |
| 5563 |
my $glob_patterns = $pgdump_runs{$run}->{glob_patterns}; |
| 5564 |
foreach my $glob_pattern (@{$glob_patterns}) |
| 5565 |
{ |
| 5566 |
my @glob_output = glob($glob_pattern); |
| 5567 |
is(scalar(@glob_output) > 0, |
| 5568 |
1, "$run: glob check for $glob_pattern"); |
| 5569 |
} |
| 5570 |
} |
| 5571 |
|
| 5572 |
if ($pgdump_runs{$run}->{command_like}) |
| 5573 |
{ |
| 5574 |
my $cmd_like = $pgdump_runs{$run}->{command_like}; |
| 5575 |
$node->command_like( |
| 5576 |
\@{ $cmd_like->{command} }, |
| 5577 |
$cmd_like->{expected}, |
| 5578 |
"$run: " . $cmd_like->{name}); |
| 5579 |
} |
| 5580 |
|
| 5581 |
if ($pgdump_runs{$run}->{restore_cmd}) |
| 5582 |
{ |
| 5583 |
$node->command_ok(\@{ $pgdump_runs{$run}->{restore_cmd} }, |
| 5584 |
"$run: pg_restore runs"); |
| 5585 |
} |
| 5586 |
|
| 5587 |
if ($pgdump_runs{$run}->{test_key}) |
| 5588 |
{ |
| 5589 |
$test_key = $pgdump_runs{$run}->{test_key}; |
| 5590 |
} |
| 5591 |
|
| 5592 |
my $output_file = slurp_file("$tempdir/${run}.sql"); |
| 5593 |
|
| 5594 |
######################################### |
| 5595 |
# Run all tests where this run is included |
| 5596 |
# as either a 'like' or 'unlike' test. |
| 5597 |
|
| 5598 |
foreach my $test (sort keys %tests) |
| 5599 |
{ |
| 5600 |
my $test_db = 'postgres'; |
| 5601 |
|
| 5602 |
if (defined($pgdump_runs{$run}->{database})) |
| 5603 |
{ |
| 5604 |
$run_db = $pgdump_runs{$run}->{database}; |
| 5605 |
} |
| 5606 |
|
| 5607 |
if (defined($tests{$test}->{database})) |
| 5608 |
{ |
| 5609 |
$test_db = $tests{$test}->{database}; |
| 5610 |
} |
| 5611 |
|
| 5612 |
# Check for proper test definitions |
| 5613 |
# |
| 5614 |
# Either "all_runs" should be set or there should be a "like" list, |
| 5615 |
# even if it is empty. (This makes the test more self-documenting.) |
| 5616 |
if (!defined($tests{$test}->{all_runs}) |
| 5617 |
&& !defined($tests{$test}->{like})) |
| 5618 |
{ |
| 5619 |
die "missing \"like\" in test \"$test\""; |
| 5620 |
} |
| 5621 |
# Check for useless entries in "unlike" list. Runs that are |
| 5622 |
# not listed in "like" don't need to be excluded in "unlike". |
| 5623 |
if ($tests{$test}->{unlike}->{$test_key} |
| 5624 |
&& !defined($tests{$test}->{like}->{$test_key})) |
| 5625 |
{ |
| 5626 |
die "useless \"unlike\" entry \"$test_key\" in test \"$test\""; |
| 5627 |
} |
| 5628 |
|
| 5629 |
# Skip any collation-related commands if there is no collation support |
| 5630 |
if (!$collation_support && defined($tests{$test}->{collation})) |
| 5631 |
{ |
| 5632 |
next; |
| 5633 |
} |
| 5634 |
|
| 5635 |
# Skip any icu-related collation commands if build was without icu |
| 5636 |
if (!$supports_icu && defined($tests{$test}->{icu})) |
| 5637 |
{ |
| 5638 |
next; |
| 5639 |
} |
| 5640 |
|
| 5641 |
# Skip tests specific to LZ4 if this build does not support |
| 5642 |
# this option. |
| 5643 |
if (!$supports_lz4 && defined($tests{$test}->{lz4})) |
| 5644 |
{ |
| 5645 |
next; |
| 5646 |
} |
| 5647 |
|
| 5648 |
if ($run_db ne $test_db) |
| 5649 |
{ |
| 5650 |
next; |
| 5651 |
} |
| 5652 |
|
| 5653 |
# Run the test if all_runs is set or if listed as a like, unless it is |
| 5654 |
# specifically noted as an unlike (generally due to an explicit |
| 5655 |
# exclusion or similar). |
| 5656 |
if (($tests{$test}->{like}->{$test_key} || $tests{$test}->{all_runs}) |
| 5657 |
&& !defined($tests{$test}->{unlike}->{$test_key})) |
| 5658 |
{ |
| 5659 |
if (!ok($output_file =~ $tests{$test}->{regexp}, |
| 5660 |
"$run: should dump $test")) |
| 5661 |
{ |
| 5662 |
diag("Review $run results in $tempdir"); |
| 5663 |
} |
| 5664 |
} |
| 5665 |
else |
| 5666 |
{ |
| 5667 |
if (!ok($output_file !~ $tests{$test}->{regexp}, |
| 5668 |
"$run: should not dump $test")) |
| 5669 |
{ |
| 5670 |
diag("Review $run results in $tempdir"); |
| 5671 |
} |
| 5672 |
} |
| 5673 |
} |
| 5674 |
} |
| 5675 |
|
| 5676 |
######################################### |
| 5677 |
# Stop the database instance, which will be removed at the end of the tests. |
| 5678 |
|
| 5679 |
$node->stop('fast'); |
| 5680 |
|
| 5681 |
done_testing(); |