1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

For PostgreSQL::Test compatibility, alias entire package symbol tables.

Remove the need to edit back-branch-specific code sites when
back-patching the addition of a PostgreSQL::Test::Utils symbol.  Replace
per-symbol, incomplete alias lists.  Give old and new package names the
same EXPORT and EXPORT_OK semantics.  Back-patch to v10 (all supported
versions).

Reviewed by Andrew Dunstan.

Discussion: https://postgr.es/m/20220622072144.GD4167527@rfd.leadboat.com
This commit is contained in:
Noah Misch
2022-06-25 09:07:44 -07:00
parent 9e0d9a24ef
commit ec26f44d53
4 changed files with 22 additions and 90 deletions

View File

@ -146,6 +146,17 @@ of finding port numbers, registering instances for cleanup, etc.
sub new
{
my ($class, $name, $pghost, $pgport) = @_;
# Use release 15+ semantics when the arguments look like (node_name,
# %params). We can't use $class to decide, because get_new_node() passes
# a v14- argument list regardless of the class. $class might be an
# out-of-core subclass. $class->isa('PostgresNode') returns true even for
# descendants of PostgreSQL::Test::Cluster, so it doesn't help.
return $class->get_new_node(@_[ 1 .. $#_ ])
if !$pghost
or !$pgport
or $pghost =~ /^[a-zA-Z0-9_]$/;
my $testname = basename($0);
$testname =~ s/\.[^.]+$//;
my $self = {
@ -2307,18 +2318,4 @@ sub corrupt_page_checksum
=cut
# support release 15+ perl module namespace
package PostgreSQL::Test::Cluster; ## no critic (ProhibitMultiplePackages)
sub new
{
shift; # remove class param from args
return PostgresNode->get_new_node(@_);
}
no warnings 'once';
*get_free_port = *PostgresNode::get_free_port;
1;