From: | Ken Dibble <ken(at)beckydibble(dot)com> |
---|---|
To: | pgsql-novice(at)lists(dot)postgresql(dot)org |
Subject: | Re: Command Line option misunderstanding |
Date: | 2024-12-03 08:56:22 |
Message-ID: | cfc006a2-6467-4e3f-a9ad-a71426413dd9@beckydibble.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On 12/2/24 19:11, David G. Johnston wrote:
> On Mon, Dec 2, 2024 at 4:50 PM 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 a
> *DuckDuckGo* did not detect any trackers. More
> <https://duckduckgo.com/email/report#RFVDSzI.G_sBYJwFdqyxdoaHS2myO1fUIntbMMNtUafXrz9hUwl-PtvNQAVSvHGy6HCtO8ZY-19rS9q-tUCyrNspTbUFdiALLdUzwe-cZboqp4yT17AvyMeQ7HMCJuzut4lnjkRdCQt-tke66ZAFiXixmU8RLXAcGMQQP4jvEo2v9BG-2TfAgrYvhPqHmdg7PuSVFDAUKI017XKphBK8KR0AuK45TSMFs5QGbcI4EkaMcKqFf0hr-2RhboNSU7Ex5owJ_7L4vKgoJ-d3LggtKCekamjVElMT53hVGsZaaUvTOFESUiotpeWi1KxVmou2kq5R0nGjmREtLUYDgL9Wd-xAkGAE9AOXQ9nXUr--H0-Xt_P-AQ>
>
>
> Deactivate
> <https://duckduckgo.com/email/addresses/eyJhY3RpdmUiOmZhbHNlLCJhZGRyZXNzIjoicHVuY2gtaGFzc2xlLWd1aXNlIiwiYWRkcmVzc190b2tlbiI6ImRpdjVndHU2aXJ1dmh5N3kifQ>
>
>
> On Mon, Dec 2, 2024 at 4:50 PM <punch-hassle-guise(at)duck(dot)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.
>
> The word "line" here belies further misunderstanding of how
> shell-executed commands work (the following "two line" command is
> still just one actual multiple-option command invocation).
> psql -v a=1 \
> -c 'select :a'
>
> It is best to just say "using -c and -v together".
>
> It is correct that we haven't pointed out, probably because for
> experienced people it seems obvious, that using -v and -c (or putting
> \set in -c) is a pointless thing to do. But psql doesn't go about
> trying to analyze intent here so, yes, you either get useless
> successful output in response or a confused server.
>
> That said...
> psql -v a=1 -c '\echo :a' postgres
> 1
>
> So it truly is just this specific SQL-related usage that is pointless,
> not combining -v and -c generally (I'm sure a useful backslash command
> can be substituted for \echo)
>
>
> Related Question:
>
> Documentation says:
>
> /|command|/ must be either a command string that is completely
> parsable by the server (i.e., it contains no psql-specific
> features), or a single backslash command.
>
> $psql -h anna -d GT7 -c "\set a '11117' \\ select evt_id from
> events where sport_mode_evt_id=:a"
>
> Really not caring that you are turning on autocommit...
>
> Anyway, what I believe you managed to accomplish here is to set the
> named variable "a" to the value <single-quote 11117 single-quote
> blah-blah-blah equals colon a>
>
> Then proceeded to do nothing with that variable since the -c command
> was done being evaluated in the "single backslash command" mode.
>
> David J.
>
Thanks for your time and explanations.
Ken
From | Date | Subject | |
---|---|---|---|
Next Message | Ken Dibble | 2024-12-03 08:57:28 | Re: Command Line option misunderstanding |
Previous Message | Laurenz Albe | 2024-12-03 06:12:54 | Re: Command Line option misunderstanding |