Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHtim-0004kK-Ou for pgsql-bugs@arkaria.postgresql.org; Wed, 31 Oct 2018 16:51:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHtik-0000LK-Bq for pgsql-bugs@arkaria.postgresql.org; Wed, 31 Oct 2018 16:51:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHtik-0000LD-23 for pgsql-bugs@lists.postgresql.org; Wed, 31 Oct 2018 16:51:54 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHtic-0003tu-R1 for pgsql-bugs@lists.postgresql.org; Wed, 31 Oct 2018 16:51:52 +0000 Received: from [192.168.127.1] (port=41634 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1gHtia-000FJN-1X; Wed, 31 Oct 2018 16:51:44 +0000 Received: from [127.0.0.1] (port=11435 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gHtiZ-0004wY-BK; Wed, 31 Oct 2018 16:51:43 +0000 From: Andrew Gierth To: pgsql-bugs@lists.postgresql.org, bubthegreat@gmail.com Subject: Re: BUG #15474: Special character escape sequences need better documentation, or more easily found documentation In-Reply-To: <15474-a10e03c9efe552f3@postgresql.org> (PG Bug reporting form's message of "Wed, 31 Oct 2018 16:25:06 +0000") Message-ID: <87wopy5aj2.fsf@news-spur.riddles.org.uk> References: <15474-a10e03c9efe552f3@postgresql.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Wed, 31 Oct 2018 16:51:43 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "PG" == PG Bug reporting form 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)