On Fri, Aug 17, 2012 at 06:55:14PM +0100, Richard Huxton wrote:
> >Well, it'd be nice to allow substitution there ...
> >
> >>What we can't easily do is to allow quotes to prevent variable
> >>substitution in these whole-line commands because we can't process the
> >>quotes because that will remove them.
> >
> >... but if there is then no way to prevent it, that's absolutely
> >unacceptable.
> 
> If I'm understanding this correctly, \copy parsing just passes the
> query part unaltered as part of a COPY statement back into the
> top-level parser. Likewise with the \!shell stuff (but presumably to
> execve).
> 
> To handle variable-substitution correctly for \copy we'd need to
> duplicate the full parsing for COPY. For \! we'd need something
> which understood shell-syntax (for the various shells out there).
> Ick.
> 
> Or you'd need a separate variable-bracketing {{:x}} syntax that
> could work like reverse dollar-quoting. Also Ick.
> 
> As far as we know this has only inconvenienced one person (me) badly
> enough to report a maybe-bug. Thanks for trying Bruce, but I fear
> this is one itch that'll go unscratched.
> 
> Rest assured I'm not about to storm off and replace all my
> installations with MySQL :-)

Good analysis.  Basically we can't hope to fully understand COPY or
shell quoting syntax well enough to properly replace only unquoted psql
variable references.

Therefore, unless I hear otherwise, I will just document the limitation
and withdraw the patch.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to