Re: psql metaqueries with \gexec - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: psql metaqueries with \gexec
Date
Msg-id CADkLM=fvhsfrDBLRnK4jjrNtYp+-NPJqP9SZjEVRa6C2WREZ9A@mail.gmail.com
Whole thread Raw
In response to Re: psql metaqueries with \gexec  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Responses Re: psql metaqueries with \gexec  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers

I'm getting a warning from this patch:

1 warning generated.

Fixed that one.


(note that I'm using CC='ccache clang -Qunused-arguments -fcolor-diagnostics')

        for (r = 0; r < nrows; r++)
        {
                for (c = 0; c < ncolumns; c++)
                {
etc...

Normally we don't use gratuitous {'s, and I don't think it's helping anything in this case. But I'll let whoever commits this decide.


Good to know in the future. I can remove or leave to the committer.


diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 5f27120..0f87f29 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1280,8 +1280,8 @@ psql_completion(const char *text, int start, int end)
                "\\dm", "\\dn", "\\do", "\\dO", "\\dp", "\\drds", "\\ds", "\\dS",
                "\\dt", "\\dT", "\\dv", "\\du", "\\dx", "\\dy",
                "\\e", "\\echo", "\\ef", "\\encoding", "\\ev",
-               "\\f", "\\g", "\\gset", "\\h", "\\help", "\\H", "\\i", "\\ir", "\\l",
-               "\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
+               "\\f", "\\g", "\\gexec", "\\gset", "\\h", "\\help", "\\H", "\\i", "\\ir",
+               "\\l", "\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",

FWIW, it's generally better to leave that kind of re-wrapping to the next pg_indent run.

Good to know in the future. Not much point in undoing it now, I suppose.
 

I added tests for ON_ERROR_STOP. New patch attached.

I was wondering if ON_ERROR_STOP tests were verbotten because you only get to kick the tires on one feature...
 

The patch still needs to document this feature in the psql docs (and maybe the manpage? not sure how that's generated...)

doc/src/sgml/ref/psql-ref.sgml is the source for both html and man pagers.

I'm on it. I didn't expect the name "gexec" to survive first contact with the community.

Patch attached. Changes are thus:
- proper assignment of success var
- added documentation to psql manpage/html with examples pulled from regression tests.

Not changed are:
- exuberant braces, can remove if someone wants me to
- attempt at line-wrappng the enumerated slash commands, leave that to pg_indent

Attachment

pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Re: remove wal_level archive
Next
From: David Steele
Date:
Subject: Re: Batch update of indexes