On Tue, Apr 21, 2009 at 09:33:26AM -0700, David Fetter wrote:
> On Tue, Apr 21, 2009 at 09:26:13AM -0700, Joshua D. Drake wrote:
> > On Tue, 2009-04-21 at 12:19 -0400, Alvaro Herrera wrote:
> > 
> > > I suggested this to Bruce over IM:
> > > 
> > > \df[antw][S+]     list [only agg/normal/trigger/window] functions
> > > 
> > > (one line only, removing the second redundant line).  This seems
> > > clea[nr]er to me.  Bruce says it would confuse users.  But really, if
> > > you can understand the [S+] stuff you should be able to get the [antw]
> > > stuff too, right?
> > > 
> > 
> > +1 to Alvaro. 
> 
> Now psql allows you to mix all of the options freely (scary math word
> ahead) in an idempotent way.  In other words, this works:
> 
> \df++aannSw
> 
> Expressed as a regex, it's \\df[antwS+]*
> 
> Cheers,
> David.

Oh, and I forgot to send some error-handling and cleanup code per
Alvaro.  Please find attached. :)

Cheers,
David.
-- 
David Fetter <da...@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fet...@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 6dfa33f..d2a4384 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -202,13 +202,19 @@ describeFunctions(const char *functypes, const char 
*pattern, bool verbose, bool
        bool                    showTrigger = strchr(functypes, 't') != NULL;
        bool                    showWindow = strchr(functypes, 'w') != NULL;
 
+       if (strlen(functypes) != strspn(functypes, "antwS+"))
+       {
+               fprintf(stderr, _("\\df only takes [antwS+] as options\n"));
+               return true;
+       }
+
        PQExpBufferData buf;
        PGresult   *res;
        printQueryOpt myopt = pset.popt;
 
        if (showWindow && pset.sversion < 80400)
        {
-               fprintf(stderr, _("\\df does not take a \"w\" decorator in 
%d.%d.\n"),
+               fprintf(stderr, _("\\df does not take a \"w\" option in 
%d.%d.\n"),
                                pset.sversion / 10000, (pset.sversion / 100) % 
100);
                return true;
        }
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to