pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Verite <daniel@manitou-mail.org>
Cc: Ashutosh Sharma <ashu.coek88@gmail.com>
Cc: Rahila Syed <rahilasyed90@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Improvements in psql hooks for variables
Date: Fri, 20 Jan 2017 09:02:10 -0500
Message-ID: <25606.1484920930@sss.pgh.pa.us> (raw)
In-Reply-To: <1dee8049-2bb7-428c-bef4-46745722c61e@manitou-mail.org>
References: <1dee8049-2bb7-428c-bef4-46745722c61e@manitou-mail.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

"Daniel Verite" <daniel@manitou-mail.org> writes:
> Setting ENCODING has no effect, like DBNAME, USER, HOST and PORT.
> In a way, it's a read-only variable that's here to inform the user,
> not as a means to change the encoding (\encoding does that and
> has proper support for tab completion)

Right.

> What we could do as of this patch is emit an error when we try
> to change ENCODING, with a hook returning false and
> a proper error message hinting to \encoding.

I think that the current behavior is intentional: it avoids making
those variables reserved.  That is, if you're unaware that psql
sets them and try to use them for your own purposes, it will work.

However, it only really works if psql never overwrites the values
after startup, whereas I believe all of these are overwritten by
a \c command.

So maybe it's more user-friendly to make these variables fully
reserved, even at the risk of breaking existing scripts.  But
I don't think it's exactly an open-and-shut question.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (54+ messages)  latest in thread

Message-ID: <25606.1484920930@sss.pgh.pa.us>
Permalink:  ../25606.1484920930@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25606.1484920930@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, daniel@manitou-mail.org, ashu.coek88@gmail.com, rahilasyed90@gmail.com, sfrost@snowman.net, ashutosh.bapat@enterprisedb.com
  Subject: Re: Improvements in psql hooks for variables
  In-Reply-To: <25606.1484920930@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox