Re: [HACKERS] psql \copy warning - Mailing list pgsql-patches

From Tom Lane
Subject Re: [HACKERS] psql \copy warning
Date
Msg-id 518.1148854965@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] psql \copy warning  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [HACKERS] psql \copy warning  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> The attached patch fixes the warning you received by adding E'' strings
> to the \copy arguments, and adds it for the other backslash commands
> like \d.

Further comment on this: I don't think we want all these places
individually making this sort of decision.  What they should all be
doing is using appendStringLiteralConn to generate the properly-quoted
literal.  (I fixed this already in describe.c, but not in those other
places.)

Once we've got that done, we could argue about whether appendStringLiteral
ought to prepend an E to silence escape_string_warning.  I'd still vote
no, but at least it would be a single place to change and not N of 'em.
What's more, each place that is generating a variable literal without
using appendStringLiteral or PQescapeString is at least potentially
vulnerable to encoding issues, and so we should probably convert them
anyway.

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] psql \copy warning
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] psql \copy warning