Re: Command Line option misunderstanding - Mailing list pgsql-novice

From Laurenz Albe
Subject Re: Command Line option misunderstanding
Date
Msg-id f6c98da81f11aca47e6f407a1c76c8265cdb1c2a.camel@cybertec.at
Whole thread Raw
In response to Command Line option misunderstanding  (punch-hassle-guise@duck.com)
List pgsql-novice
On Mon, 2024-12-02 at 18:49 -0500, punch-hassle-guise@duck.com 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



pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Command Line option misunderstanding
Next
From: Ken Dibble
Date:
Subject: Re: Command Line option misunderstanding