Show tablespace for databases with psql's \l+

Lists: pgsql-patches
From: Philip Yarra <philip(at)utiba(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Show tablespace for databases with psql's \l+
Date: 2006-03-30 00:34:22
Message-ID: 200603301034.22815.philip@utiba.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Following discussion
(http://archives.postgresql.org/pgsql-hackers/2006-03/msg01208.php) here's a
patch to add tablespace to the output of psql's \l+. New output (with psql
-E) looks like this:

pyarra=# \l+
********* QUERY **********
SELECT d.datname as "Name",
r.rolname as "Owner",
pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding",
pg_catalog.shobj_description(d.oid, 'pg_database') as "Description",
t.spcname as "Tablespace"
FROM pg_catalog.pg_database d
JOIN pg_catalog.pg_roles r ON d.datdba = r.oid
JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid
ORDER BY 1;
**************************

List of databases
Name | Owner | Encoding | Description | Tablespace
-----------+--------+----------+---------------------------+------------
postgres | pyarra | LATIN1 | | pg_default
pyarra | pyarra | LATIN1 | | pg_default
spctest | pyarra | LATIN1 | | spctable
template0 | pyarra | LATIN1 | | pg_default
template1 | pyarra | LATIN1 | Default template database | pg_default
(5 rows)

Please let me know if this patch needs any changes for acceptance. I would
prefer the tablespace row to the left of Description, but opted for minimal
change to get patch accepted. Will re-order them if others are in favour.

Regards, Philip.

-----------------
Utiba Pty Ltd
This message has been scanned for viruses and
dangerous content by Utiba mail server and is
believed to be clean.

Attachment Content-Type Size
patch-psql-db-tblspc-show text/x-diff 1.6 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Yarra <philip(at)utiba(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Show tablespace for databases with psql's \l+
Date: 2006-03-30 03:13:29
Message-ID: 9182.1143688409@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Philip Yarra <philip(at)utiba(dot)com> writes:
> Please let me know if this patch needs any changes for acceptance. I would
> prefer the tablespace row to the left of Description,

Me too --- that looks pretty weird as-is.

regards, tom lane


From: Philip Yarra <philip(at)utiba(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Show tablespace for databases with psql's \l+
Date: 2006-03-30 03:32:39
Message-ID: 200603301332.40212.philip@utiba.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Thu, 30 Mar 2006 01:13 pm, Tom Lane wrote:
> Philip Yarra <philip(at)utiba(dot)com> writes:
> > Please let me know if this patch needs any changes for acceptance. I
> > would prefer the tablespace row to the left of Description,
>
> Me too --- that looks pretty weird as-is.

OK, revised patch attached. Less-weird output now looks like this:

List of databases
Name | Owner | Encoding | Tablespace | Description
-----------+--------+----------+------------+---------------------------
postgres | pyarra | LATIN1 | pg_default |
pyarra | pyarra | LATIN1 | pg_default |
spctest | pyarra | LATIN1 | spctable |
template0 | pyarra | LATIN1 | pg_default |
template1 | pyarra | LATIN1 | pg_default | Default template database
(5 rows)

Much nicer, I think.

Regards, Philip.

--

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

-----------------
Utiba Pty Ltd
This message has been scanned for viruses and
dangerous content by Utiba mail server and is
believed to be clean.

Attachment Content-Type Size
patch-psql-db-tblspc-show2 text/x-diff 1.6 KB

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Philip Yarra <philip(at)utiba(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Show tablespace for databases with psql's \l+
Date: 2006-04-26 23:15:41
Message-ID: 200604262315.k3QNFfw06562@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Patch applied. Thanks.

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

Philip Yarra wrote:
> On Thu, 30 Mar 2006 01:13 pm, Tom Lane wrote:
> > Philip Yarra <philip(at)utiba(dot)com> writes:
> > > Please let me know if this patch needs any changes for acceptance. I
> > > would prefer the tablespace row to the left of Description,
> >
> > Me too --- that looks pretty weird as-is.
>
> OK, revised patch attached. Less-weird output now looks like this:
>
> List of databases
> Name | Owner | Encoding | Tablespace | Description
> -----------+--------+----------+------------+---------------------------
> postgres | pyarra | LATIN1 | pg_default |
> pyarra | pyarra | LATIN1 | pg_default |
> spctest | pyarra | LATIN1 | spctable |
> template0 | pyarra | LATIN1 | pg_default |
> template1 | pyarra | LATIN1 | pg_default | Default template database
> (5 rows)
>
> Much nicer, I think.
>
> Regards, Philip.
>
> --
>
> "Debugging is twice as hard as writing the code in the first place.
> Therefore, if you write the code as cleverly as possible, you are,
> by definition, not smart enough to debug it." - Brian W. Kernighan
>
> -----------------
> Utiba Pty Ltd
> This message has been scanned for viruses and
> dangerous content by Utiba mail server and is
> believed to be clean.
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: 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
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +