Re: pgbench - add \aset to store results of a combined query

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench - add \aset to store results of a combined query
Date: 2020-04-02 06:08:08
Message-ID: alpine.DEB.2.21.2004020729120.16227@pseudo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Bonjour Michaël,

>> Except for the addition of a test case to skip empty results when
>> \aset is used, I think that we are pretty good here.
>
> While hacking on the patch more by myself, I found that mixing tests
> for \gset and \aset was rather messy. A test for an empty result
> leads also to a failure with the pgbench command as we want to make
> sure that the variable does not exist in this case using debug().

ISTM that I submitted a patch to test whether a variable exists in
pgbench, like available in psql (:{?var} I think), but AFAICS it did not
pass. Maybe I should resurect it as it would allow to test simply whether
an empty result was returned to aset, which could make sense in a bench
script (get something, if it does not exist skip remainder… I can see some
interesting use cases).

> So let's split the tests in three parts:
> - the set for \get is left alone.
> - addition of a new set for the valid cases of \aset.
> - addition of an invalid test for \aset (the empty set one).

Ok.

> Fabien, what do you think about the attached?

It does not need to create an UNLOGGED table, a mere "WHERE FALSE"
suffices.

I do not understand why you removed the comment about meta which makes it
false, so I added something minimal back.

> Perhaps we should also have a test where we return more than 1 row for
> \get? The last point is unrelated to this thread though.

Yes, but ISTM that it is not worth a dedicated patch… so I added a test
similar to the one about empty aset.

See v7 attached.

--
Fabien.

Attachment Content-Type Size
pgbench-aset-7.patch text/x-diff 10.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2020-04-02 06:11:48 Re: Berserk Autovacuum (let's save next Mandrill)
Previous Message Amit Kapila 2020-04-02 06:02:16 Re: User Interface for WAL usage data