Re: Making background psql nicer to use in tap tests

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>

From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Daniel Gustafsson <daniel@yesql.se>, Andres Freund <andres@anarazel.de>, Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Melanie Plageman <melanieplageman@gmail.com>
Date: 2023-03-17T18:07:40Z
Lists: pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:

> On 2023-03-17 Fr 10:08, Daniel Gustafsson wrote:
>>> Why is $restart_before_query a package/class level value instead of
>>> an instance value? And why can we only ever set it to 1 but not back
>>> again? Maybe we don't want to, but it looks odd.
>> It was mostly a POC to show what I meant with the functionality.  I think there
>> should be a way to turn it off (set it to zero) even though I doubt it will be
>> used much.
>
>
> A common idiom is to have a composite getter/setter method for object
> properties something like this
>
>
>    sub settingname
>    {
>       my ($self, $arg) = @_;
>       $self->{settingname} = $arg if defined $arg;
>       return $self->{settingname};
>    }

Or, if undef is a valid value:


    sub settingname
    {
        my $self = shift;
        $self->[settingname} = shift if @_;
        return $self->{settingname};
    }

- ilmari



Commits

  1. Fix missing installation/uninstallation rules for BackgroundPsql.pm

  2. Backport BackgroundPsql perl test module

  3. Add missing uninstallation rule for BackgroundPsql.pm

  4. Fix missing installation rules for BackgroundPsql.pm

  5. Skip \password TAP test on old IPC::Run versions

  6. Test SCRAM iteration changes with psql \password

  7. Refactor background psql TAP functions