Re: Small TAP improvements

2022-11-14 Thread Andrew Dunstan
On 2022-11-09 We 05:35, Andrew Dunstan wrote: > On 2022-11-06 Su 08:51, Álvaro Herrera wrote: >> On 2022-Jun-14, Andrew Dunstan wrote: >> >>> OK, here's a more principled couple of patches. For config_data, if you >>> give multiple options it gives you back the list of values. If you don't >>> sp

Re: Small TAP improvements

2022-11-09 Thread Andrew Dunstan
On 2022-11-06 Su 08:51, Álvaro Herrera wrote: > On 2022-Jun-14, Andrew Dunstan wrote: > >> OK, here's a more principled couple of patches. For config_data, if you >> give multiple options it gives you back the list of values. If you don't >> specify any, in scalar context it just gives you back a

Re: Small TAP improvements

2022-11-06 Thread Álvaro Herrera
On 2022-Jun-14, Andrew Dunstan wrote: > OK, here's a more principled couple of patches. For config_data, if you > give multiple options it gives you back the list of values. If you don't > specify any, in scalar context it just gives you back all of pg_config's > output, but in array context it gi

Re: Small TAP improvements

2022-06-15 Thread Michael Paquier
On Wed, Jun 15, 2022 at 07:59:10AM -0400, Andrew Dunstan wrote: > My would we do that? If you want a map don't pass any switches. But as > written you could do: > > my ($incdir, $localedir, $sharedir) = $node->config_data(qw(--includedir > --localedir --sharedir)); > > No map needed to get what

Re: Small TAP improvements

2022-06-15 Thread Andrew Dunstan
On 2022-06-14 Tu 19:13, Michael Paquier wrote: > On Tue, Jun 14, 2022 at 12:20:56PM -0400, Tom Lane wrote: >> Andrew Dunstan writes: >>> The second changes the new GUCs TAP test to check against the installed >>> postgresql.conf.sample rather than the one in the original source >>> location. The

Re: Small TAP improvements

2022-06-15 Thread Andrew Dunstan
On 2022-06-14 Tu 19:24, Michael Paquier wrote: > On Tue, Jun 14, 2022 at 05:08:28PM -0400, Tom Lane wrote: >> Andrew Dunstan writes: >>> OK, here's a more principled couple of patches. For config_data, if you >>> give multiple options it gives you back the list of values. If you don't >>> specif

Re: Small TAP improvements

2022-06-14 Thread Michael Paquier
On Tue, Jun 14, 2022 at 05:08:28PM -0400, Tom Lane wrote: > Andrew Dunstan writes: > > OK, here's a more principled couple of patches. For config_data, if you > > give multiple options it gives you back the list of values. If you don't > > specify any, in scalar context it just gives you back all

Re: Small TAP improvements

2022-06-14 Thread Michael Paquier
On Tue, Jun 14, 2022 at 12:20:56PM -0400, Tom Lane wrote: > Andrew Dunstan writes: >> The second changes the new GUCs TAP test to check against the installed >> postgresql.conf.sample rather than the one in the original source >> location. There are probably arguments both ways, but if we ever dec

Re: Small TAP improvements

2022-06-14 Thread Tom Lane
Andrew Dunstan writes: > OK, here's a more principled couple of patches. For config_data, if you > give multiple options it gives you back the list of values. If you don't > specify any, in scalar context it just gives you back all of pg_config's > output, but in array context it gives you a map,

Re: Small TAP improvements

2022-06-14 Thread Andrew Dunstan
On 2022-06-14 Tu 12:44, Álvaro Herrera wrote: > The comment atop config_data still mentions $option, but after the patch > that's no longer a name used in the function. (I have to admit that using @_ > in the body of the function was a little bit confusing to me at first. Did > you do that in o

Re: Small TAP improvements

2022-06-14 Thread Andrew Dunstan
On 2022-06-14 Tu 12:20, Tom Lane wrote: > Andrew Dunstan writes: >> The first makes the argument for $node->config_data() optional. If it's >> not supplied, pg_config is called without an argument and the whole >> result is returned. Currently, if you try that you get back a nasty and >> cryptic

Re: Small TAP improvements

2022-06-14 Thread Álvaro Herrera
The comment atop config_data still mentions $option, but after the patch that's no longer a name used in the function. (I have to admit that using @_ in the body of the function was a little bit confusing to me at first. Did you do that in order to allow multiple options to be passed?) Also: if

Re: Small TAP improvements

2022-06-14 Thread Tom Lane
Andrew Dunstan writes: > The first makes the argument for $node->config_data() optional. If it's > not supplied, pg_config is called without an argument and the whole > result is returned. Currently, if you try that you get back a nasty and > cryptic error. No opinion about whether that's useful.

Small TAP improvements

2022-06-14 Thread Andrew Dunstan
Here's a couple of small patches I came up with while doing some related work on TAP tests. The first makes the argument for $node->config_data() optional. If it's not supplied, pg_config is called without an argument and the whole result is returned. Currently, if you try that you get back a nas