Thread: string containing (')

string containing (')

From
Atika
Date:
HI!
Can anyone help,
I want to store a string into a relation that might contain an apostrophe
(').  Is there anyway around this or can I not store such strings.
Thanks for your help



Re: [SQL] string containing (')

From
Bruce Momjian
Date:
> HI!
> Can anyone help,
> I want to store a string into a relation that might contain an apostrophe
> (').  Is there anyway around this or can I not store such strings.
> Thanks for your help
>
>
>
>

'\''

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: [SQL] string containing (')

From
Brian Baquiran
Date:
Bruce Momjian wrote:
>
> > HI!
> > Can anyone help,
> > I want to store a string into a relation that might contain an apostrophe
> > (').  Is there anyway around this or can I not store such strings.
> > Thanks for your help
>
> '\''

I've always thought the proper way was to use 2 quotes ('').

Brian

Re: [SQL] string containing (')

From
Herouth Maoz
Date:
At 18:06 +0200 on 20/03/1999, Brian Baquiran wrote:


> >
> > > HI!
> > > Can anyone help,
> > > I want to store a string into a relation that might contain an apostrophe
> > > (').  Is there anyway around this or can I not store such strings.
> > > Thanks for your help
> >
> > '\''
>
> I've always thought the proper way was to use 2 quotes ('').

It is the proper way, as far as compatibility to standard SQL is concerned.
Both methods are supported by PostgreSQL, though.

I have a certain grievance against PostgreSQL and its escaping mechanism,
which makes scripts written in standard SQL produce wrong results if they
have backslashes in them.

Perhaps there should be a switch, SET COMPATIBILITY or something, which
disables incompatible parses from taking place, and allows using legacy
script with little concern for the content of the strings.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma