Re: What characters need to be quoted? - Mailing list pgsql-general

From Jeff Davis
Subject Re: What characters need to be quoted?
Date
Msg-id 200209122102.34396.list-pgsql-general@empires.org
Whole thread Raw
In response to What characters need to be quoted?  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
List pgsql-general
> Are there any characters besides the single quote that need to be
> escaped when inserting into PostgresQL?

Also escape backslashes, and the NUL byte (0x00), in addition to the single
quote.

Note that bytea will nicely format output into printable text with escape
codes for the unprintable characters. The text types (char,varchar,text)
aren't as nice about that, and you might end up with unprintable characters
if you store them in that type.

> And am I right in thinking that the SQL standard calls for putting one
> single quote in front of a single quote to escape it (and not use a
> backslash as some other DBs would have you do?)

I believe that either two single quotes or a backslash and a single quote are
the same in PostgreSQL.

Regards,
    Jeff

pgsql-general by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: Mailing lists archive search
Next
From: Justin Clift
Date:
Subject: An opportunity to prove PostgreSQL and our requirement of Case Study info