Re: problems with single quotes..

From: "postgresql" <pgsql(at)symcom(dot)com>
To: "Megalex" <megalex(at)klanomega(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: problems with single quotes..
Date: 2001-12-02 21:48:11
Message-ID: 200112022135.fB2LZem43627@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> Insert Into table(userID,FirstName,LastName) values(1,'''\''','test')
I don't know if you have been able to figure out yet what you need but think of it
this way:
'Nick' is a quoted word. let's form the possesive (nick's)
'Nick\'s' notice you still have the outside quotes. The slash is telling the system
to ignore the single quote that directly follows it.

so what you want is:
INSERT INTO table (userID, FirstName, LastName) VALUES (1, 'william', 'L\'sale')
if you intend to have a single quote in the middle of a string (L'sale)

Ted

-----Original Message-----
From: "Megalex" <megalex(at)klanomega(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Date: Thu, 4 Jan 2001 12:57:19 -0600
Subject: [SQL] problems with single quotes..

> ok.. here is my deal..
>
> everytime i try to run an insert and my text contains '\'
> it fails..
>
> an sql example would be.
>
> Insert Into table(userID,FirstName,LastName) values(1,'''\''','test')
> and i get this message...
>
> Error while executing the query; ERROR: parser: parse error at or near
> "test"
>
> how can i fix this??
>
> Alex,

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto Mello 2001-12-02 22:20:14 Re: contracting tables
Previous Message Anthony Bouvier 2001-12-02 20:43:36 Re: Unexpected Return from Function