Re: proposal: multiple psql option -c

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Catalin Iacob <iacobcatalin(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Adam Brightwell <adam(dot)brightwell(at)crunchydatasolutions(dot)com>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, dinesh kumar <dineshkumar02(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: multiple psql option -c
Date: 2015-11-15 14:53:10
Message-ID: 56489C56.6040606@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/15/2015 08:50 AM, Catalin Iacob wrote:
> On Sun, Nov 15, 2015 at 1:27 AM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>> That seems to me to get rid of the main motivation for this change, which is
>> to allow multiple such arguments, which together would as as if they were
>> all written to a file which was then invoked like -f file.
> It seems to me the motivation is not "multiple command line arguments"
> but sending multiple statements to the backend in one psql invocation
> without needing bash specific here docs or a temporary file for -f.
> Most combinations of such multiple statements can already be sent via
> -c which sends them in one query, the backend executes them in one
> transaction but the backend rejects some combinations like SELECT +
> VACUUM.
>
> I think the proposal was mislead by the apparent similarity with -c
> and said "if -c can't do SELECT + VACUUM let's do a sort of repeated
> -c and call that -C SELECT -C VACUUM". But why not do the same with -C
> "SELECT 1; VACUUM" which works just like having a file with that
> content works today but handier for scripts? Doesn't this solve the
> exact need in this thread?
>
> I'm arguing that sending multiple statements and executing each in one
> transaction (the current proposed semantics of -C) is not like -c and
> doesn't need to be "repeated -c" it's exactly like reading stdin or
> file passed to -f and solves the original problem.But maybe I'm
> missing something.
>

I suggest you review the original thread on this subject before a line
was ever written. "multiple" (see subject line on this whole thread) is
clearly what is being asked for. Making people turn that into a single
argument is not what was envisaged. See for example Pavel's original
example involving use of xargs where that's clearly not at all easy.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2015-11-15 17:59:22 Re: eXtensible Transaction Manager API
Previous Message Robert Haas 2015-11-15 14:50:25 Re: Proposal: "Causal reads" mode for load balancing reads without stale data