Re: Characters that needs escape characters when inserting to database

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: "Christian Paul B(dot) Cosinas" <cpc(at)cybees(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Characters that needs escape characters when inserting to database
Date: 2006-01-17 17:56:42
Message-ID: 20060117175642.GA11363@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Jan 17, 2006 at 04:20:23PM +0900, Michael Glaesemann wrote:
> On Jan 18, 2006, at 7:21 , Christian Paul B. Cosinas wrote:
> >Can anyone give me a list of characters that needs to be preceded
> >by an escape character before inserting to database.
>
> Take a look at this documentation on string constants. It should
> answer the questions you have.
> http://www.postgresql.org/docs/current/interactive/sql-syntax.html#SQL-SYNTAX-STRINGS

Out of curiosity, why are you asking? Unless you're implementing
some low-level interface to the database you shouldn't need to worry
about escaping strings; just use your API's quote/escape (or whatever)
function or its placeholder mechanism (if it has one). If you're
using an interface that doesn't have any of these capabilities, what
is it? Some people might want to avoid it ;-)

--
Michael Fuhr

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message George Pavlov 2006-01-17 20:57:30 non-equi self-join optimization
Previous Message Michael Glaesemann 2006-01-17 07:20:23 Re: Characters that needs escape characters when inserting to database