Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group