Re: How to insert apostrophied names into postgres

From: "Vyacheslav Kalinin" <vka(at)mgcp(dot)com>
To: rterry(at)internode(dot)on(dot)net
Cc: "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: How to insert apostrophied names into postgres
Date: 2008-02-19 00:23:55
Message-ID: 9b1af80e0802181623l74ea6fd2vbb91210a64f35ab4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

http://www.postgresql.org/docs/8.3/interactive/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS

Either of:
* double the quote (e.g. 'Peter''s')
* use backslash escape (e.g. E'Peter\'s', note the "E" prefix that
means the string is an escape string)
* use $-quoting (e.g. $x$Peter's$x$)
* if you are working with some external interfaces use appropriate
escaping function they provide (for instance in libpq:
PQescapeStringConn -
http://www.postgresql.org/docs/8.3/interactive/libpq-exec.html#LIBPQ-EXEC-ESCAPE-STRING,
PHP: pg-escape-string -
http://ru2.php.net/manual/en/function.pg-escape-string.php)
* use PQexecParams
(http://www.postgresql.org/docs/8.3/interactive/libpq-exec.html) or
its wrappers (as pg_exec_params in PHP)
* use prepared statements:
http://www.postgresql.org/docs/8.3/interactive/sql-prepare.html or
PQprepare - http://www.postgresql.org/docs/8.3/interactive/libpq-exec.html#LIBPQ-EXEC-MAIN

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Vishal Mailinglist 2008-02-19 00:52:33 Re: Using Regular expresion
Previous Message Phillip Smith 2008-02-19 00:20:02 Re: How to insert apostrophied names into postgres