Skip to content

Commit 6e10631

Browse files
committed
pg_dump test: Make concatenated create_sql commands more readable
When the pg_dump 002_pg_dump.pl test generates the command to load the schema, it does # Add terminating semicolon $create_sql{$test_db} .= $tests{$test}->{create_sql} . ";"; In some cases, this creates a duplicate semicolon, but more importantly, this doesn't add any newline. So if you look at the result in either the server log or in tmp_check/log/regress_log_002_pg_dump, it looks like a complete mess. This patch makes the output look cleaner for manual inspection: add semicolon only if necessary, and add two newlines. Discussion: https://www.postgresql.org/message-id/flat/d6aec95a-8729-43cc-2578-f2a5e46640e0%40enterprisedb.com
1 parent a73952b commit 6e10631

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bin/pg_dump/t/002_pg_dump.pl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3984,8 +3984,12 @@
39843984
next;
39853985
}
39863986
3987-
# Add terminating semicolon
3988-
$create_sql{$test_db} .= $tests{$test}->{create_sql} . ";";
3987+
# Normalize command ending: strip all line endings, add
3988+
# semicolon if missing, add two newlines.
3989+
my $create_sql = $tests{$test}->{create_sql};
3990+
chomp $create_sql;
3991+
$create_sql .= ';' unless substr($create_sql, -1) eq ';';
3992+
$create_sql{$test_db} .= $create_sql . "\n\n";
39893993
}
39903994
}
39913995

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy