Re: [HACKERS] TAP: allow overriding PostgresNode in get_new_node - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [HACKERS] TAP: allow overriding PostgresNode in get_new_node
Date
Msg-id CA+TgmoZkwfjttP4Z4LSC=bpqbBOCKmufVGs6NvF=6s25-bOTUQ@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] TAP: allow overriding PostgresNode in get_new_node  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: [HACKERS] TAP: allow overriding PostgresNode in get_new_node
Re: [HACKERS] TAP: allow overriding PostgresNode in get_new_node
List pgsql-hackers
On Thu, Jun 1, 2017 at 3:36 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Wed, May 31, 2017 at 7:18 PM, Craig Ringer <craig@2ndquadrant.com> wrote:
>> Note that you can achieve the same effect w/o patching
>> PostgresNode.pm, albeit in a somewhat ugly manner, by re-blessing the
>> returned object.
>>
>> sub get_new_mywhatever_node {
>>         my $self = PostgresNode::get_new_node($name);
>>         $self = bless $self, 'MyWhateverNode';
>>         return $self;
>> }
>>
>> so this would be cosmetically nice, but far from functionally vital.
>
> +    $pgnclass = 'PostgresNode' unless defined $pgnclass;
> I'd rather leave any code of this kind for the module maintainers,
> there is no actual reason to complicate PostgresNode.pm with code
> that's not directly useful for what is in-core.

Craig's proposal is a standard Perl idiom, though.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] pg_class.relpartbound definition overly brittle
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] BEFORE trigger can cause undetected partitionconstraint violation