public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: [email protected]
To: [email protected] <[email protected]>
Subject: Re: Command Line option misunderstanding
Date: Tue, 03 Dec 2024 07:12:54 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On Mon, 2024-12-02 at 18:49 -0500, [email protected] wrote:
> The problem seems to be, as alluded to by others attempting to help me 
> that the problem only exists when using -c on the same line as -v. 
> I am guessing here, that my original question should have been:
> 
> "Why is it okay to use a psql variable declared on a command line in a psql session
> that was started from said command line and not with a session that was created and
> destroyed with a -c command switch?"

"Why" questions tend to be difficult to answer.
The simple answer is: because somebody implemented it that way.

I dug into the commit history, and the current behavior seems to stem from commit
a45195a191 from 1999 that introduced psql variables and has the lapidary commit
message "Major psql overhaul by Peter Eisentraut".
I couldn't find a pertinent discussion on the list.

If you dislike the current behavior enough, you could write a patch that changes
it.  There might be some resistence, however, because a behavoir change like that
could break existing scripts and persent a backward incompatibility.

Yours,
Laurenz Albe





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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Command Line option misunderstanding
  In-Reply-To: <[email protected]>

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

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