Re: What characters need to be quoted?

From: Jeff Davis <list-pgsql-general(at)empires(dot)org>
To: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: What characters need to be quoted?
Date: 2002-09-13 04:02:34
Message-ID: 200209122102.34396.list-pgsql-general@empires.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Justin Clift 2002-09-13 05:28:12 An opportunity to prove PostgreSQL and our requirement of Case Study info
Previous Message Marc G. Fournier 2002-09-13 03:55:55 Re: Mailing lists archive search