psql with "Function Type" in \df

Started by David Fetterabout 17 years ago50 messageshackers
Jump to latest
#1David Fetter
david@fetter.org

Folks,

Here's a patch that adds a "Function Type" column to \df while
removing the now-redundant \da.

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

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Attachments:

describe_type.difftext/plain; charset=us-asciiDownload+42-109
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: David Fetter (#1)
Re: psql with "Function Type" in \df

David Fetter <david@fetter.org> writes:

Here's a patch that adds a "Function Type" column to \df while
removing the now-redundant \da.

Removing \da altogether was nowhere in the consensus, or even in the
discussion AFAIR. Also, what is the point of using single-letter
type codes when you've made the column header about as verbose as
it could get? I'd go for something like

Type

window
agg
trigger
normal

Or we could spell out "aggregate", but that makes the column a
couple of characters wider ...

regards, tom lane

#3Greg Sabino Mullane
greg@turnstep.com
In reply to: David Fetter (#1)
Re: psql with "Function Type" in \df

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Here's a patch that adds a "Function Type" column to \df while
removing the now-redundant \da.

1. How does it make it redundant - is there a way to view all
aggregates with \df now?

2. Even if the above is satisfied, I think we need a little more
discussion before completely removing a now-functioning backslash
command.

Other than that, +1 ;)

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation
PGP Key: 0x14964AC8 200904131945
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAknjzrgACgkQvJuQZxSWSsjoWQCfSNxVbmL85Z6FDMQOu8rmsHxh
wuwAn1t0pmQ8cqI/e3m+3eADi7cMTGOm
=wKRy
-----END PGP SIGNATURE-----

#4David Fetter
david@fetter.org
In reply to: Tom Lane (#2)
Re: psql with "Function Type" in \df

On Mon, Apr 13, 2009 at 07:24:31PM -0400, Tom Lane wrote:

David Fetter <david@fetter.org> writes:

Here's a patch that adds a "Function Type" column to \df while
removing the now-redundant \da.

Removing \da altogether was nowhere in the consensus, or even in the
discussion AFAIR.

It's back.

Also, what is the point of using single-letter type codes when
you've made the column header about as verbose as it could get? I'd
go for something like

Type

window
agg
trigger
normal

Or we could spell out "aggregate", but that makes the column a
couple of characters wider ...

Done.

I've also added \df[antw], which lets people narrow their search.

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

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Attachments:

describe_type_extraletters.difftext/plain; charset=us-asciiDownload+274-51
#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: David Fetter (#4)
Re: psql with "Function Type" in \df

David Fetter <david@fetter.org> writes:

On Mon, Apr 13, 2009 at 07:24:31PM -0400, Tom Lane wrote:

I'd go for something like

Type

window
agg
trigger
normal

Or we could spell out "aggregate", but that makes the column a
couple of characters wider ...

Done.

I had a second thought about that: presumably we should make the
function type names translatable. If we do that, it might be better
to make the aggregate case be "aggregate" and take the width hit.
Otherwise translators are going to be puzzled when they come across
"agg" as a translatable phrase.

Or maybe I'm overthinking that problem. Comments from anyone who
actually does translations?

I've also added \df[antw], which lets people narrow their search.

Why didn't you make it work like \d[tisv], ie allow more than one
letter? If you're going to be inventing new features at this late
date, they should at least work like the adjacent precedent.

regards, tom lane

#6David Fetter
david@fetter.org
In reply to: Tom Lane (#5)
Re: psql with "Function Type" in \df

On Tue, Apr 14, 2009 at 12:35:21PM -0400, Tom Lane wrote:

David Fetter <david@fetter.org> writes:

On Mon, Apr 13, 2009 at 07:24:31PM -0400, Tom Lane wrote:

I'd go for something like

Type

window
agg
trigger
normal

Or we could spell out "aggregate", but that makes the column a
couple of characters wider ...

Done.

I had a second thought about that: presumably we should make the
function type names translatable. If we do that, it might be better
to make the aggregate case be "aggregate" and take the width hit.
Otherwise translators are going to be puzzled when they come across
"agg" as a translatable phrase.

OK

Or maybe I'm overthinking that problem. Comments from anyone who
actually does translations?

I've also added \df[antw], which lets people narrow their search.

Why didn't you make it work like \d[tisv], ie allow more than one
letter? If you're going to be inventing new features at this late
date, they should at least work like the adjacent precedent.

Because I didn't think of it. Lemme see about that :)

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

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

#7Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#5)
Re: psql with "Function Type" in \df

Tom Lane wrote:

I had a second thought about that: presumably we should make the
function type names translatable. If we do that, it might be better
to make the aggregate case be "aggregate" and take the width hit.
Otherwise translators are going to be puzzled when they come across
"agg" as a translatable phrase.

I think it's good to have them translatable. As for using "aggregate"
instead of "agg" I don't think it's that great an idea. If you need to
notify translators that "agg" stands for "aggregate", add a
/* translator: */ comment.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#8David Fetter
david@fetter.org
In reply to: Alvaro Herrera (#7)
Re: psql with "Function Type" in \df

On Tue, Apr 14, 2009 at 02:52:32PM -0400, Alvaro Herrera wrote:

Tom Lane wrote:

I had a second thought about that: presumably we should make the
function type names translatable. If we do that, it might be
better to make the aggregate case be "aggregate" and take the
width hit. Otherwise translators are going to be puzzled when
they come across "agg" as a translatable phrase.

I think it's good to have them translatable. As for using
"aggregate" instead of "agg" I don't think it's that great an idea.
If you need to notify translators that "agg" stands for "aggregate",
add a /* translator: */ comment.

Where would I add that? First mention, each time, or...?

Cheers,
David (reworking patch per suggestions)
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

#9Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: David Fetter (#8)
Re: psql with "Function Type" in \df

David Fetter wrote:

On Tue, Apr 14, 2009 at 02:52:32PM -0400, Alvaro Herrera wrote:

I think it's good to have them translatable. As for using
"aggregate" instead of "agg" I don't think it's that great an idea.
If you need to notify translators that "agg" stands for "aggregate",
add a /* translator: */ comment.

Where would I add that? First mention, each time, or...?

Is there more than one mention of "agg"?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#10David Fetter
david@fetter.org
In reply to: Alvaro Herrera (#9)
Re: psql with "Function Type" in \df

On Tue, Apr 14, 2009 at 03:04:55PM -0400, Alvaro Herrera wrote:

David Fetter wrote:

On Tue, Apr 14, 2009 at 02:52:32PM -0400, Alvaro Herrera wrote:

I think it's good to have them translatable. As for using
"aggregate" instead of "agg" I don't think it's that great an
idea. If you need to notify translators that "agg" stands for
"aggregate", add a /* translator: */ comment.

Where would I add that? First mention, each time, or...?

Is there more than one mention of "agg"?

It's in 3 branches in describe.c.

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

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

#11David Fetter
david@fetter.org
In reply to: Alvaro Herrera (#7)
Re: psql with "Function Type" in \df

On Tue, Apr 14, 2009 at 02:52:32PM -0400, Alvaro Herrera wrote:

Tom Lane wrote:

I had a second thought about that: presumably we should make the
function type names translatable. If we do that, it might be better
to make the aggregate case be "aggregate" and take the width hit.
Otherwise translators are going to be puzzled when they come across
"agg" as a translatable phrase.

I think it's good to have them translatable. As for using "aggregate"
instead of "agg" I don't think it's that great an idea. If you need to
notify translators that "agg" stands for "aggregate", add a
/* translator: */ comment.

Here's the next revision :)

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

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Attachments:

describe_type_extraletters2.difftext/plain; charset=us-asciiDownload+172-36
#12David Fetter
david@fetter.org
In reply to: David Fetter (#11)
Re: psql with "Function Type" in \df

On Tue, Apr 14, 2009 at 03:18:06PM -0700, David Fetter wrote:

On Tue, Apr 14, 2009 at 02:52:32PM -0400, Alvaro Herrera wrote:

Tom Lane wrote:

I had a second thought about that: presumably we should make the
function type names translatable. If we do that, it might be better
to make the aggregate case be "aggregate" and take the width hit.
Otherwise translators are going to be puzzled when they come across
"agg" as a translatable phrase.

I think it's good to have them translatable. As for using "aggregate"
instead of "agg" I don't think it's that great an idea. If you need to
notify translators that "agg" stands for "aggregate", add a
/* translator: */ comment.

Here's the next revision :)

This time, with less-Byzantine logic, and no egregious whitespace
changes. :)

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

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Attachments:

describe_type_extraletters3.difftext/plain; charset=us-asciiDownload+158-27
#13Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: David Fetter (#12)
Re: psql with "Function Type" in \df

David Fetter wrote:

I think it's good to have them translatable. As for using "aggregate"
instead of "agg" I don't think it's that great an idea. If you need to
notify translators that "agg" stands for "aggregate", add a
/* translator: */ comment.

The "translator: " comment needs to be in the line just above the
string. Right now the PO file looks like this:

#: describe.c:243 describe.c:288 describe.c:304
msgid "agg"
msgstr ""

#. translator: "agg" is short for "aggregate"
#: describe.c:244
msgid "window"
msgstr ""

Note really what we want ...

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#14David Fetter
david@fetter.org
In reply to: Alvaro Herrera (#13)
Re: psql with "Function Type" in \df

On Wed, Apr 15, 2009 at 08:54:10PM -0400, Alvaro Herrera wrote:

David Fetter wrote:

I think it's good to have them translatable. As for using "aggregate"
instead of "agg" I don't think it's that great an idea. If you need to
notify translators that "agg" stands for "aggregate", add a
/* translator: */ comment.

The "translator: " comment needs to be in the line just above the
string. Right now the PO file looks like this:

#: describe.c:243 describe.c:288 describe.c:304
msgid "agg"
msgstr ""

#. translator: "agg" is short for "aggregate"
#: describe.c:244
msgid "window"
msgstr ""

Note really what we want ...

Is this any better?

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

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Attachments:

describe_type_extraletters4.difftext/plain; charset=us-asciiDownload+161-27
#15Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: David Fetter (#14)
Re: psql with "Function Type" in \df

David Fetter wrote:

On Wed, Apr 15, 2009 at 08:54:10PM -0400, Alvaro Herrera wrote:

The "translator: " comment needs to be in the line just above the
string.

Is this any better?

Yeah, this one is good (as far as this very minor detail is concerned anyway)

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#16Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: David Fetter (#14)
Re: psql with "Function Type" in \df

David Fetter wrote:

Is this any better?

So what happens if I do \dfaQ? It should throw an error, yes?

This help line:

+ fprintf(output, _(" \\df[S+] [PATTERN] list functions. Add a, n, t, w for aggregate, normal, trigger, window\n"));

needs shortening to below 80 chars (or maybe split it in two lines.
Just make sure they are a single translation item).

It also seems like we're missing tab completion support for this.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#17David Fetter
david@fetter.org
In reply to: Alvaro Herrera (#16)
Re: psql with "Function Type" in \df

On Fri, Apr 17, 2009 at 04:42:31PM -0400, Alvaro Herrera wrote:

David Fetter wrote:

Is this any better?

So what happens if I do \dfaQ? It should throw an error, yes?

This help line:

+ fprintf(output, _(" \\df[S+] [PATTERN] list functions. Add a, n, t, w for aggregate, normal, trigger, window\n"));

needs shortening to below 80 chars (or maybe split it in two lines.
Just make sure they are a single translation item).

OK.

It also seems like we're missing tab completion support for this.

Oops. Working on that now.

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

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

#18David Fetter
david@fetter.org
In reply to: Alvaro Herrera (#16)
Re: psql with "Function Type" in \df

On Fri, Apr 17, 2009 at 04:42:31PM -0400, Alvaro Herrera wrote:

David Fetter wrote:

Is this any better?

So what happens if I do \dfaQ? It should throw an error, yes?

Interesting question.

This help line:

+ fprintf(output, _(" \\df[S+] [PATTERN] list functions. Add a, n, t, w for aggregate, normal, trigger, window\n"));

needs shortening to below 80 chars (or maybe split it in two lines.
Just make sure they are a single translation item).

It also seems like we're missing tab completion support for this.

This is another interesting question. I notice that the tab
completion doesn't support things like \dit.

Should I add that as a separate patch?

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

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

#19Bruce Momjian
bruce@momjian.us
In reply to: David Fetter (#14)
Re: psql with "Function Type" in \df

David Fetter wrote:

On Wed, Apr 15, 2009 at 08:54:10PM -0400, Alvaro Herrera wrote:

David Fetter wrote:

I think it's good to have them translatable. As for using "aggregate"
instead of "agg" I don't think it's that great an idea. If you need to
notify translators that "agg" stands for "aggregate", add a
/* translator: */ comment.

The "translator: " comment needs to be in the line just above the
string. Right now the PO file looks like this:

#: describe.c:243 describe.c:288 describe.c:304
msgid "agg"
msgstr ""

#. translator: "agg" is short for "aggregate"
#: describe.c:244
msgid "window"
msgstr ""

Note really what we want ...

Is this any better?

Modified patch applied. I modified the \? display to be two lines:

\df[S+] [PATTERN] list functions
\df[antwS+] [PATTERN] list only agg/normal/trigger/window functions

and adjusted the code and documentation a bit. I removed the
release.sgml patch because that part will be done when the release notes
are updated and I was worried it might confuse things to add it now.

Thanks, the output looks very good.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

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

Attachments:

/rtmp/difftext/x-diffDownload+186-165
#20Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Bruce Momjian (#19)
Re: psql with "Function Type" in \df

Bruce Momjian <bruce@momjian.us> wrote:

\df[S+] [PATTERN] list functions
\df[antwS+] [PATTERN] list only agg/normal/trigger/window functions

Shouldn't that second line have some curly braces? Like maybe:

\df{antw}[S+] [PATTERN] list only agg/normal/trigger/window functions

Technically, it should probably be even more verbose, but this might
be adequate.

-Kevin

#21Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Kevin Grittner (#20)
#22Joshua D. Drake
jd@commandprompt.com
In reply to: Alvaro Herrera (#21)
#23Bruce Momjian
bruce@momjian.us
In reply to: Kevin Grittner (#20)
#24David Fetter
david@fetter.org
In reply to: Joshua D. Drake (#22)
#25Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Alvaro Herrera (#21)
#26Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Bruce Momjian (#23)
#27David Fetter
david@fetter.org
In reply to: David Fetter (#24)
#28Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: David Fetter (#27)
#29Tom Lane
tgl@sss.pgh.pa.us
In reply to: Kevin Grittner (#26)
#30David Fetter
david@fetter.org
In reply to: Alvaro Herrera (#28)
#31Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#21)
#32Bruce Momjian
bruce@momjian.us
In reply to: David Fetter (#30)
#33tomas@tuxteam.de
tomas@tuxteam.de
In reply to: Bruce Momjian (#31)
#34Bruce Momjian
bruce@momjian.us
In reply to: tomas@tuxteam.de (#33)
#35tomas@tuxteam.de
tomas@tuxteam.de
In reply to: Bruce Momjian (#34)
#36Bruce Momjian
bruce@momjian.us
In reply to: tomas@tuxteam.de (#35)
#37Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#36)
#38Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#37)
#39Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#38)
#40Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#39)
#41Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: David Fetter (#17)
#42David Fetter
david@fetter.org
In reply to: Alvaro Herrera (#41)
#43Tom Lane
tgl@sss.pgh.pa.us
In reply to: David Fetter (#42)
#44David Fetter
david@fetter.org
In reply to: Tom Lane (#43)
#45Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: David Fetter (#44)
#46David Fetter
david@fetter.org
In reply to: Alvaro Herrera (#45)
#47Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: David Fetter (#46)
#48Bruce Momjian
bruce@momjian.us
In reply to: David Fetter (#18)
#49David Fetter
david@fetter.org
In reply to: Bruce Momjian (#48)
#50Bruce Momjian
bruce@momjian.us
In reply to: David Fetter (#49)