Re: Proposal: USING clause for DO statement - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: Proposal: USING clause for DO statement
Date
Msg-id 162867790911211155v496a329ak23bb9545a5f4e2d@mail.gmail.com
Whole thread Raw
In response to Re: Proposal: USING clause for DO statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Proposal: USING clause for DO statement
List pgsql-hackers
>
> The main limitation of this type of approach is that it's hard to
> properly quote a variable value that might contain any random character
> sequence.  However, that's also true of the variable-interpolation stuff
> Pavel was proposing.  In any case I don't think that "getting stuff from
> psql variables into a DO script" is the way to define the problem.
> It's "getting stuff from shell variables into a DO script" that is the
> real-world problem.

I am probably out, Tom

Hypothetically - when we are able to pass any value to DO script, then
I don't see problem. If I use Andrew's design - ${shellvar} and add it
to psql parser, then I could to write

\set par1 world

do $$ begin   raise notice 'Helo, % and %', $1, $2; end;
$$ using :par1, ${USER};

> Maybe psql is the wrong tool altogether.

why - psql is very good tool. I am able to do all what I need - but
sometimes I have to use shell expansion - it's need quoting, and the
code isn't much readable. With parameters we can to separate code from
values - and an code should very clean.

Pavel

>
>                        regards, tom lane
>


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Hot standby and removing VACUUM FULL
Next
From: Heikki Linnakangas
Date:
Subject: Re: Hot standby and removing VACUUM FULL