Patch to add objetct size on "\d+" verbose output
Hi all,
I don't know if I can post a patch here (I did subscribe to
psql-patches but without success).
Well, working in the latest revision from CVS I added a feature for
psql to the command "\d+", now it shows the object size as like as
"\l+" show the database size.
I will be pretty glad with yours sugestions and opnion.
Thanks.
--
[]s
Dickson S. Guedes
-------------------------------------
Projeto Colmeia - Curitiba - PR
(41) 3254-7130 ramal: 27
http://makeall.wordpress.com/
http://planeta.postgresql.org.br/
Attachments:
psql-table-size-on-verbose.patchtext/x-patch; name=psql-table-size-on-verbose.patchDownload
Index: describe.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/describe.c,v
retrieving revision 1.166
diff -c -r1.166 describe.c
*** describe.c 30 Mar 2008 18:10:20 -0000 1.166
--- describe.c 11 Apr 2008 04:59:56 -0000
***************
*** 1766,1775 ****
--- 1766,1781 ----
gettext_noop("Table"));
if (verbose)
+ {
appendPQExpBuffer(&buf,
",\n pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
gettext_noop("Description"));
+ appendPQExpBuffer(&buf,
+ ",\n pg_catalog.pg_size_pretty(pg_catalog.pg_relation_size(c.oid)) as \"%s\"",
+ gettext_noop("Size"));
+ }
+
appendPQExpBuffer(&buf,
"\nFROM pg_catalog.pg_class c"
"\n JOIN pg_catalog.pg_roles r ON r.oid = c.relowner"
***************
*** 1809,1816 ****
processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "c.relname", NULL,
"pg_catalog.pg_table_is_visible(c.oid)");
!
! appendPQExpBuffer(&buf, "ORDER BY 1,2;");
res = PSQLexec(buf.data, false);
termPQExpBuffer(&buf);
--- 1815,1825 ----
processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "c.relname", NULL,
"pg_catalog.pg_table_is_visible(c.oid)");
!
! if (verbose)
! appendPQExpBuffer(&buf, "ORDER BY 1, pg_catalog.pg_relation_size(c.oid) DESC, 2;");
! else
! appendPQExpBuffer(&buf, "ORDER BY 1,2;");
res = PSQLexec(buf.data, false);
termPQExpBuffer(&buf);
Dickson dos Santos Guedes escribi�:
Well, working in the latest revision from CVS I added a feature for
psql to the command "\d+", now it shows the object size as like as
"\l+" show the database size.
Added to May commitfest page, thanks.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
On Sat, Apr 12, 2008 at 3:53 AM, Dickson dos Santos Guedes
<guediz@gmail.com> wrote:
Well, working in the latest revision from CVS I added a feature for
psql to the command "\d+", now it shows the object size as like as
"\l+" show the database size.
I was going to try this patch out, but it would not apply. Seems that
where the patch should have &, it has & instead. Has this somehow
been HTML entity-ified?
Cheers,
BJ
On Sat, Apr 12, 2008 at 7:43 PM, Brendan Jurd <direvus@gmail.com> wrote:
I was going to try this patch out, but it would not apply. Seems that
where the patch should have &, it has & instead. Has this somehow
been HTML entity-ified?
Hi Brendan,
You are right, I don't now why this occurs. I'm sending it now
gziped, You may test it again.
Thank you.
--
[]s
Dickson S. Guedes
-------------------------------------
Projeto Colmeia - Curitiba - PR
(41) 3254-7130 ramal: 27
http://makeall.wordpress.com/
http://planeta.postgresql.org.br/
Attachments:
On Mon, Apr 14, 2008 at 8:45 AM, Dickson dos Santos Guedes
<guediz@gmail.com> wrote:
On Sat, Apr 12, 2008 at 7:43 PM, Brendan Jurd <direvus@gmail.com> wrote:
I was going to try this patch out, but it would not apply. Seems that
where the patch should have &, it has & instead. Has this somehow
been HTML entity-ified?You are right, I don't now why this occurs. I'm sending it now
gziped, You may test it again.
Hi Dickson,
I actually already corrected the '&'s manually and tested your
patch like that. It's nice -- I think this is a very worthwhile
addition to \dt+
I note that your last email only went to -hackers; you might want to
send the updated version of your patch to -patches as well.
Cheers,
BJ
Dickson dos Santos Guedes wrote:
On Sat, Apr 12, 2008 at 7:43 PM, Brendan Jurd <direvus@gmail.com> wrote:
I was going to try this patch out, but it would not apply. Seems that
where the patch should have &, it has & instead. Has this somehow
been HTML entity-ified?Hi Brendan,
You are right, I don't now why this occurs. I'm sending it now
gziped, You may test it again.
Although it would often be nice to see tables sorted by size, I don't
like having a different ordering in verbose mode, that's just confusing.
Patch committed, sans the ordering change. I also moved the Size column
before Description, I think it looks better to have the potentially long
Description column at the end. It's also consistent with the \l+ output
that way.
Thanks for the patch!
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
On Fri, May 2, 2008 at 7:16 AM, Heikki Linnakangas
<heikki@enterprisedb.com> wrote:
Although it would often be nice to see tables sorted by size, I don't like
having a different ordering in verbose mode, that's just confusing.
Yes, I agree.
Patch committed, sans the ordering change. I also moved the Size column
before Description, I think it looks better to have the potentially long
Description column at the end. It's also consistent with the \l+ output that
way.
Excelent. It is better.
Thanks for the patch!
Thanks for your suggestions.
--
[]s
Dickson S. Guedes
-------------------------------------
Projeto Colmeia - Curitiba - PR
(41) 3254-7130 ramal: 27
http://makeall.wordpress.com/
http://planeta.postgresql.org.br/