Re: psql metaqueries with \gexec

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org>, PostgreSQL <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql metaqueries with \gexec
Date: 2016-04-04 19:46:09
Message-ID: CADkLM=eS6BiaG5i8OWyD4uP4nMj_z8i-9Z4xfRZ1txx05UrABA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 4, 2016 at 3:31 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Corey Huinker <corey(dot)huinker(at)gmail(dot)com> writes:
> > Patch attached. Changes are thus:
> > - rebased
> > - pset.gexec_flag unconditionally set to false at end of SendQuery
> > - wording of documentation describing execution order of results
> > - rebasing allowed for undoing the re-wrap of enumerated slash commands.
>
> I whacked this around some and committed it. The main thing that was
>

Hooray!

> broken is that it didn't work nicely at all if you'd set FETCH_COUNT.
>

Mmm, yeah, I hadn't considered cursor fetches, but in the use cases (at
least the ones I can imagine for this) you wouldn't want fetches.

> I experimented with different approaches to that, and ultimately decided
> that the best answer is to disable use of ExecQueryUsingCursor for the
> \gexec master query. We can still let it be used for the individual
> generated queries, though.
>

Fine by me.

>
> I didn't much like the regression test setup, either. Tests that
> have to be at the end of their test files aren't very nice, unless
> you give them their very own test file, which checking ON_ERROR_STOP
> didn't seem worth. To me it's far more important that the code
> respond to cancel_pressed (which, ahem, it wasn't) and we have no
> mechanism for testing that in a pg_regress script. So I just dropped
> that aspect of it and put the test in a more logical place in the file.
>

I think it was Jim that added the ON_ERROR_STOP check. I wasn't sure how to
properly test that.

Thanks for finding (and fixing) the cancel_pressed issue.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-04-04 20:00:09 Re: Timeline following for logical slots
Previous Message Tom Lane 2016-04-04 19:37:06 Re: WIP: Covering + unique indexes.