>
> 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
>