Skip site navigation (1) Skip section navigation (2)

Re: small psql patch - show Schema name for \dt \dv \dS

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: small psql patch - show Schema name for \dt \dv \dS
Date: 2002-07-31 01:06:43
Message-ID: 200207310106.g6V16h505592@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
I just added pg_stat_get_backend_mypid() that returns the pid.  Does
that help you?

---------------------------------------------------------------------------

Joe Conway wrote:
> Tom Lane wrote:
> > It seems rather odd and confusing that the sort order takes the second
> > column as the major key.
> 
> Maybe I'm a rather odd and confused kind of guy ;-)
> 
> > I think that the sort ordering should be
> > column 1 then 2.  That means either putting the schema column first,
> > or keeping this column ordering and sorting on relname before schema.
> > I lean towards the first choice but can see a case for the second.
> 
> Here's another small patch, to implement Tom's first choice above. I 
> looked at re-adding your own "pg_temp_n" schema back into the results. 
> But I don't see a way to determine your own BackendId unless we add a 
> builtin function to expose MyBackendId as a user callable function. 
> Should we do this, or did I just miss something?
> 
> If there are no objections, please apply.
> 
> Thanks,
> 
> Joe

> Index: src/bin/psql/describe.c
> ===================================================================
> RCS file: /opt/src/cvs/pgsql/src/bin/psql/describe.c,v
> retrieving revision 1.56
> diff -c -r1.56 describe.c
> *** src/bin/psql/describe.c	20 Jul 2002 05:57:31 -0000	1.56
> --- src/bin/psql/describe.c	20 Jul 2002 20:57:16 -0000
> ***************
> *** 1021,1031 ****
>   	initPQExpBuffer(&buf);
>   
>   	printfPQExpBuffer(&buf,
> ! 			 "SELECT c.relname as \"%s\",\n"
> ! 			 "  n.nspname as \"%s\",\n"
>   			 "  CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'i' THEN '%s' WHEN 'S' THEN '%s' WHEN 's' THEN '%s' END as \"%s\",\n"
>   			 "  u.usename as \"%s\"",
> ! 			 _("Name"), _("Schema"), _("table"), _("view"), _("index"), _("sequence"),
>   			 _("special"), _("Type"), _("Owner"));
>   
>   	if (desc)
> --- 1021,1031 ----
>   	initPQExpBuffer(&buf);
>   
>   	printfPQExpBuffer(&buf,
> ! 			 "SELECT n.nspname as \"%s\",\n"
> ! 			 "  c.relname as \"%s\",\n"
>   			 "  CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'i' THEN '%s' WHEN 'S' THEN '%s' WHEN 's' THEN '%s' END as \"%s\",\n"
>   			 "  u.usename as \"%s\"",
> ! 			 _("Schema"), _("Name"), _("table"), _("view"), _("index"), _("sequence"),
>   			 _("special"), _("Type"), _("Owner"));
>   
>   	if (desc)
> ***************
> *** 1068,1074 ****
>   	if (name)
>   		appendPQExpBuffer(&buf, "  AND c.relname ~ '^%s'\n", name);
>   
> ! 	appendPQExpBuffer(&buf, "ORDER BY 2,1;");
>   
>   	res = PSQLexec(buf.data);
>   	termPQExpBuffer(&buf);
> --- 1068,1074 ----
>   	if (name)
>   		appendPQExpBuffer(&buf, "  AND c.relname ~ '^%s'\n", name);
>   
> ! 	appendPQExpBuffer(&buf, "ORDER BY 1,2;");
>   
>   	res = PSQLexec(buf.data);
>   	termPQExpBuffer(&buf);

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2002-07-31 03:34:02
Subject: Re: int64 timestamp patch for contrib/pg_controldata
Previous:From: Tom LaneDate: 2002-07-30 22:51:07
Subject: Re: DROP COLUMN round 4

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group