review: psql and pset without any arguments

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Gilles Darold <gilles(dot)darold(at)dalibo(dot)com>, Marc Mamin <M(dot)Mamin(at)intershop(dot)de>, Erik Rijkers <er(at)xs4all(dot)nl>
Subject: review: psql and pset without any arguments
Date: 2013-09-07 08:02:07
Message-ID: CAFj8pRADhiMiy0rWXQ1Sg4SPDHz4UE98-AuZ3DP+Hkk2uX9B_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

* patch is cleanly patchable and compilation is without warnings
* all regression tests passed
* no impact on dump, performance or any current features
* no comments to programming style
* we would this feature - it is consistent with \set and it gives a fast
resume about psql printer settings

Issues:
1) it doesn't show linestyle when is default

I looked there and it is probably a small different issue - this value is
initialized as NULL as default. But I dislike a empty output in this case:

else if (strcmp(param, "linestyle") == 0)
{
if (!popt->topt.line_style)
;
else
printf(_("Line style is %s.\n"),
get_line_style(&popt->topt)->name);
}

I propose a verbose result instead nothing:

else if (strcmp(param, "linestyle") == 0)
{
if (!popt->topt.line_style)
printf(_("Line style is unset.\n")) ;
else
printf(_("Line style is %s.\n"),
get_line_style(&popt->topt)->name);
}

2) there is only one open question
http://www.postgresql.org/message-id/B6F6FD62F2624C4C9916AC0175D56D880CE00E0E@jenmbs01.ad.intershop.net-
there is no clean relation between output and some pset option.

I don't think so Marc' proposal is ideal (these values are not a variables)
- but maybe some enhanced output (only for this resume) can be better:

postgres=# \pset
Output format (format) is aligned.
Border style (border) is 1.
Expanded display (expanded) is off.
Null display (null) is "".
Field separator (fieldsep) is "|".
Tuples only (tuples_only) is off.
Title (title) is unset.
Table attributes (tableattr) unset.
Pager (pager) is used for long output.
Record separator (recordsep) is <newline>.

This expanded output should be used only for this resume (not when a option
was changed or individual ask on option value)

Regards

Pavel Stehule

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message MauMau 2013-09-07 11:06:16 Re: [bug fix] strerror() returns ??? in a UTF-8/C database with LC_MESSAGES=non-ASCII
Previous Message Pavel Stehule 2013-09-07 07:57:35 only linestyle is NULL as default