|
233 | 233 | '--exclude-database','*dump_test*','--no-sync',
|
234 | 234 | ],
|
235 | 235 | },
|
| 236 | +no_toast_compression=> { |
| 237 | +dump_cmd=> [ |
| 238 | +'pg_dump','--no-sync', |
| 239 | +"--file=$tempdir/no_toast_compression.sql", |
| 240 | +'--no-toast-compression','postgres', |
| 241 | +], |
| 242 | +}, |
236 | 243 | no_blobs=> {
|
237 | 244 | dump_cmd=> [
|
238 | 245 | 'pg_dump','--no-sync',
|
|
377 | 384 | # of the pg_dump runs happening. This is what "seeds" the
|
378 | 385 | # system with objects to be dumped out.
|
379 | 386 | #
|
| 387 | +# There can be a flag called 'lz4', which can be set if the test |
| 388 | +# case depends on LZ4. Tests marked with this flag are skipped if |
| 389 | +# the build used does not support LZ4. |
| 390 | +# |
380 | 391 | # Building of this hash takes a bit of time as all of the regexps
|
381 | 392 | # included in it are compiled. This greatly improves performance
|
382 | 393 | # as the regexps are used for each run the test applies to.
|
|
397 | 408 | exclude_dump_test_schema=> 1,
|
398 | 409 | exclude_test_table=> 1,
|
399 | 410 | exclude_test_table_data=> 1,
|
| 411 | +no_toast_compression=> 1, |
400 | 412 | no_blobs=> 1,
|
401 | 413 | no_owner=> 1,
|
402 | 414 | no_privs=> 1,
|
|
2071 | 2083 | unlike => { exclude_dump_test_schema => 1, },
|
2072 | 2084 | },
|
2073 | 2085 |
|
| 2086 | +'CREATE MATERIALIZED VIEW matview_compression' => { |
| 2087 | +create_order => 20, |
| 2088 | +create_sql => 'CREATE MATERIALIZED VIEW |
| 2089 | + dump_test.matview_compression (col2) AS |
| 2090 | + SELECT col2 FROM dump_test.test_table; |
| 2091 | + ALTER MATERIALIZED VIEW dump_test.matview_compression |
| 2092 | + ALTER COLUMN col2 SET COMPRESSION lz4;', |
| 2093 | +regexp => qr/^ |
| 2094 | +\QCREATE MATERIALIZED VIEW dump_test.matview_compression AS\E |
| 2095 | +\n\s+\QSELECT test_table.col2\E |
| 2096 | +\n\s+\QFROM dump_test.test_table\E |
| 2097 | +\n\s+\QWITH NO DATA;\E |
| 2098 | +.* |
| 2099 | +\QALTER TABLE ONLY dump_test.matview_compression ALTER COLUMN col2 SET COMPRESSION lz4;\E\n |
| 2100 | +/xms, |
| 2101 | +lz4 => 1, |
| 2102 | +like => |
| 2103 | + {%full_runs,%dump_test_schema_runs, section_pre_data => 1, }, |
| 2104 | +unlike => |
| 2105 | + { exclude_dump_test_schema => 1, no_toast_compression => 1, }, |
| 2106 | +}, |
| 2107 | +
|
2074 | 2108 | 'CREATE POLICY p1 ON test_table' => {
|
2075 | 2109 | create_order => 22,
|
2076 | 2110 | create_sql => 'CREATE POLICY p1 ON dump_test.test_table
|
|
2279 | 2313 | create_order => 3,
|
2280 | 2314 | create_sql => 'CREATE TABLE dump_test.test_table (
|
2281 | 2315 | col1 serial primary key,
|
2282 |
| - col2 text, |
| 2316 | + col2 text COMPRESSION pglz, |
2283 | 2317 | col3 text,
|
2284 | 2318 | col4 text,
|
2285 | 2319 | CHECK (col1 <= 1000)
|
|
2337 | 2371 | unlike => { exclude_dump_test_schema => 1, },
|
2338 | 2372 | },
|
2339 | 2373 |
|
| 2374 | +'CREATE TABLE test_compression' => { |
| 2375 | +create_order => 3, |
| 2376 | +create_sql => 'CREATE TABLE dump_test.test_compression ( |
| 2377 | + col1 int, |
| 2378 | + col2 text COMPRESSION lz4 |
| 2379 | + );', |
| 2380 | +regexp => qr/^ |
| 2381 | +\QCREATE TABLE dump_test.test_compression (\E\n |
| 2382 | +\s+\Qcol1 integer,\E\n |
| 2383 | +\s+\Qcol2 text\E\n |
| 2384 | +\);\n |
| 2385 | +.* |
| 2386 | +\QALTER TABLE ONLY dump_test.test_compression ALTER COLUMN col2 SET COMPRESSION lz4;\E\n |
| 2387 | +/xms, |
| 2388 | +lz4 => 1, |
| 2389 | +like => |
| 2390 | + {%full_runs,%dump_test_schema_runs, section_pre_data => 1, }, |
| 2391 | +unlike => |
| 2392 | + { exclude_dump_test_schema => 1, no_toast_compression => 1, }, |
| 2393 | +}, |
| 2394 | +
|
2340 | 2395 | 'CREATE TABLE measurement PARTITIONED BY' => {
|
2341 | 2396 | create_order => 90,
|
2342 | 2397 | create_sql => 'CREATE TABLE dump_test.measurement (
|
|
2686 | 2741 | defaults => 1,
|
2687 | 2742 | exclude_test_table => 1,
|
2688 | 2743 | exclude_test_table_data => 1,
|
| 2744 | +no_toast_compression => 1, |
2689 | 2745 | no_blobs => 1,
|
2690 | 2746 | no_privs => 1,
|
2691 | 2747 | no_owner => 1,
|
|
2758 | 2814 | exclude_dump_test_schema => 1,
|
2759 | 2815 | exclude_test_table => 1,
|
2760 | 2816 | exclude_test_table_data => 1,
|
| 2817 | +no_toast_compression => 1, |
2761 | 2818 | no_blobs => 1,
|
2762 | 2819 | no_privs => 1,
|
2763 | 2820 | no_owner => 1,
|
|
3391 | 3448 | $collation_support = 1;
|
3392 | 3449 | }
|
3393 | 3450 |
|
| 3451 | +# Determine whether build supports LZ4. |
| 3452 | +my$supports_lz4 = check_pg_config("#define HAVE_LIBLZ4 1"); |
| 3453 | +
|
3394 | 3454 | # Create a second database for certain tests to work against
|
3395 | 3455 | $node->psql('postgres', 'create database regress_pg_dump_test;');
|
3396 | 3456 |
|
|
3448 | 3508 | next;
|
3449 | 3509 | }
|
3450 | 3510 |
|
| 3511 | +# Skip tests specific to LZ4 if this build does not support |
| 3512 | +# this option. |
| 3513 | +if (!$supports_lz4 && defined($tests{$test}->{lz4})) |
| 3514 | +{ |
| 3515 | +next; |
| 3516 | +} |
| 3517 | +
|
3451 | 3518 | # If there is a like entry, but no unlike entry, then we will test the like case
|
3452 | 3519 | if ($tests{$test}->{like}->{$test_key}
|
3453 | 3520 | && !defined($tests{$test}->{unlike}->{$test_key}))
|
|
3505 | 3572 | next;
|
3506 | 3573 | }
|
3507 | 3574 |
|
| 3575 | +# Skip tests specific to LZ4 if this build does not support |
| 3576 | +# this option. |
| 3577 | +if (!$supports_lz4 && defined($tests{$test}->{lz4})) |
| 3578 | +{ |
| 3579 | +next; |
| 3580 | +} |
| 3581 | +
|
3508 | 3582 | # Add terminating semicolon
|
3509 | 3583 | $create_sql{$test_db} .=$tests{$test}->{create_sql} . ";";
|
3510 | 3584 | }
|
|
3603 | 3677 | next;
|
3604 | 3678 | }
|
3605 | 3679 |
|
| 3680 | +# Skip tests specific to LZ4 if this build does not support |
| 3681 | +# this option. |
| 3682 | +if (!$supports_lz4 && defined($tests{$test}->{lz4})) |
| 3683 | +{ |
| 3684 | +next; |
| 3685 | +} |
| 3686 | +
|
3606 | 3687 | if ($run_db ne$test_db)
|
3607 | 3688 | {
|
3608 | 3689 | next;
|
|