psql: Add setting to make '+' on \d implicit

Lists: pgsql-hackers
From: Terry Brown <terry_n_brown(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql: Add setting to make '+' on \d implicit
Date: 2010-04-23 15:58:40
Message-ID: 20100423105840.49b08999@nrri.umn.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I asked on IRC if there was any way to make \d behave like \d+ by default, and davidfetter said no but suggest it here.

endpoint_david pointed out you could use \d- to get the old behavior if you wanted to temporarily negate the setting.

So the proposal would be:

\d+ does as it has always done, no change
\d- (new) always behaves like 'old' \d
\d acts as 'old' \d or as \d+, depending on the setting of 'verbose_describe', set via \pset.

Default setting of verbose_describe would presumably yield 'old' behavior.

Motivation is that I like to see comments when they exist. Probably useful for other reasons too.

Cheers -Terry


From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql: Add setting to make '+' on \d implicit
Date: 2010-04-23 18:11:32
Message-ID: 20100423181132.GG32682@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Apr 23, 2010 at 10:58:40AM -0500, Terry Brown wrote:
> I asked on IRC if there was any way to make \d behave like \d+ by default, and davidfetter said no but suggest it here.
>
> endpoint_david pointed out you could use \d- to get the old behavior if you wanted to temporarily negate the setting.
>
> So the proposal would be:
>
> \d+ does as it has always done, no change
> \d- (new) always behaves like 'old' \d
> \d acts as 'old' \d or as \d+, depending on the setting of 'verbose_describe', set via \pset.
>
> Default setting of verbose_describe would presumably yield 'old' behavior.
>
> Motivation is that I like to see comments when they exist. Probably useful for other reasons too.

Hmm, what about all the other + variants? Would this setting affect
them? I'd suggest perhaps it should.

Ross
--
Ross Reedstrom, Ph.D. reedstrm(at)rice(dot)edu
Systems Engineer & Admin, Research Scientist phone: 713-348-6166
The Connexions Project http://cnx.org fax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E F888 D3AE 810E 88F0 BEDE


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql: Add setting to make '+' on \d implicit
Date: 2010-04-23 18:28:38
Message-ID: 13372.1272047318@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Ross J. Reedstrom" <reedstrm(at)rice(dot)edu> writes:
> On Fri, Apr 23, 2010 at 10:58:40AM -0500, Terry Brown wrote:
>> So the proposal would be:
>>
>> \d+ does as it has always done, no change
>> \d- (new) always behaves like 'old' \d
>> \d acts as 'old' \d or as \d+, depending on the setting of 'verbose_describe', set via \pset.

> Hmm, what about all the other + variants? Would this setting affect
> them? I'd suggest perhaps it should.

If we were to do something like that, it would certainly have to affect
every \d variant that has a + option. Which is probably not a very good
idea --- in many cases that's a very expensive/verbose option. I can't
get excited about this proposal, personally.

What the OP actually seemed to care about was database object comments.
I could see somebody who relied heavily on comments wanting his comments
to be included in all display commands, even without the + option.
Maybe a configuration variable along the lines of 'always_show_comments'
would be a better design.

BTW, \pset seems like the wrong place for this. That's for formatting
table output, not for controlling what specific \d commands show.

regards, tom lane


From: Steve Atkins <steve(at)blighty(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: Add setting to make '+' on \d implicit
Date: 2010-04-23 21:34:45
Message-ID: 5E92CC17-71CE-45E9-955A-4DC60257CDC4@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Apr 23, 2010, at 11:28 AM, Tom Lane wrote:

> "Ross J. Reedstrom" <reedstrm(at)rice(dot)edu> writes:
>> On Fri, Apr 23, 2010 at 10:58:40AM -0500, Terry Brown wrote:
>>> So the proposal would be:
>>>
>>> \d+ does as it has always done, no change
>>> \d- (new) always behaves like 'old' \d
>>> \d acts as 'old' \d or as \d+, depending on the setting of 'verbose_describe', set via \pset.
>
>> Hmm, what about all the other + variants? Would this setting affect
>> them? I'd suggest perhaps it should.
>
> If we were to do something like that, it would certainly have to affect
> every \d variant that has a + option. Which is probably not a very good
> idea --- in many cases that's a very expensive/verbose option. I can't
> get excited about this proposal, personally.
>
> What the OP actually seemed to care about was database object comments.
> I could see somebody who relied heavily on comments wanting his comments
> to be included in all display commands, even without the + option.
> Maybe a configuration variable along the lines of 'always_show_comments'
> would be a better design.

Or more generally an ability to set aliases via .psqlrc similar to \set, maybe?

\alias "\d-" = "\d"
\alias "\d" = "\d+"

Cheers,
Steve


From: Terry Brown <terry_n_brown(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql: Add setting to make '+' on \d implicit
Date: 2010-04-24 14:01:54
Message-ID: 20100424090154.0573dbdd@nrri.umn.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 23 Apr 2010 14:28:38 -0400
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> If we were to do something like that, it would certainly have to affect
> every \d variant that has a + option. Which is probably not a very good
> idea --- in many cases that's a very expensive/verbose option. I can't
> get excited about this proposal, personally.

I was thinking of affecting all \d* commands, didn't know some were expensive though.

> What the OP actually seemed to care about was database object comments.
> I could see somebody who relied heavily on comments wanting his comments
> to be included in all display commands, even without the + option.
> Maybe a configuration variable along the lines of 'always_show_comments'
> would be a better design.

Sounds good, comment visibility is my goal. I know full metadata should be handled in other ways, but I like to do most processing in psql sessions for the self documenting effect, and seeing comments helps in that context. If \pset's not the right place anywhere else would be fine.

Thanks for considering,
Cheers -Terry


From: Terry Brown <terry_n_brown(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql: Add setting to make '+' on \d implicit
Date: 2010-04-24 14:05:37
Message-ID: 20100424090537.48b401e8@nrri.umn.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 23 Apr 2010 14:34:45 -0700
Steve Atkins <steve(at)blighty(dot)com> wrote:

> > Maybe a configuration variable along the lines of 'always_show_comments'
> > would be a better design.
>
> Or more generally an ability to set aliases via .psqlrc similar to \set, maybe?
>
> \alias "\d-" = "\d"
> \alias "\d" = "\d+"

Sounds harder but better because of the generality.

Cheers -Terry


From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: Steve Atkins <steve(at)blighty(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: Add setting to make '+' on \d implicit
Date: 2010-04-25 10:10:20
Message-ID: 369301DEC425549665632648@amenophis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

--On 23. April 2010 14:34:45 -0700 Steve Atkins <steve(at)blighty(dot)com> wrote:

> Or more generally an ability to set aliases via .psqlrc similar to \set,
> maybe?
>
> \alias "\d-" = "\d"
> \alias "\d" = "\d+"

You mean something like this?

<http://archives.postgresql.org/pgsql-patches/2008-04/msg00005.php>

--
Thanks

Bernd