From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: pgsql-bugs@lists.postgresql.org
To: bubthegreat@gmail.com
Subject: Re: BUG #15474: Special character escape sequences need better documentation, or more easily found documentation
Date: Wed, 31 Oct 2018 16:51:43 +0000
Message-ID: <87wopy5aj2.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <15474-a10e03c9efe552f3@postgresql.org>
References: <15474-a10e03c9efe552f3@postgresql.org>
>>>>> "PG" == PG Bug reporting form <noreply@postgresql.org> writes:
PG> A simple table elaborating on the escapes for each special
PG> character would be incredibly helpful at determining how to
PG> translate those escapes for cleaning strings prior to insertion so
PG> those of us using postgresql can quickly write cleaning functions
PG> for data.
If you're "writing cleaning functions" you're already making a serious
mistake, because you should be passing data values as parameters (which
do not require escapes) rather than interpolating into the query string.
If you actually do need to interpolate into the query string for some
reason (like doing COPY or other utility statement that doesn't support
parameters), then you should be using the quote/escape functions
provided by the driver for your client language (e.g. in libpq there is
PQescapeStringConn).
--
Andrew (irc:RhodiumToad)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: andrew@tao11.riddles.org.uk, bubthegreat@gmail.com
Subject: Re: BUG #15474: Special character escape sequences need better documentation, or more easily found documentation
In-Reply-To: <87wopy5aj2.fsf@news-spur.riddles.org.uk>
References: <15474-a10e03c9efe552f3@postgresql.org> <87wopy5aj2.fsf@news-spur.riddles.org.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox