Re: Special characters

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: "Mihai Gheorghiu" <tanethq(at)earthlink(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Special characters
Date: 2001-03-20 21:28:47
Message-ID: 200103202128.f2KLSlG05979@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Mihai Gheorghiu" wrote:
>I want to switch from MSAccess to Postgres.
>1. I have memo fields that include new line characters (I don't know whether
>it is actually a CR). How can this be exported to Postgres?

Represent a newline by `\n'.

>2. How do I query for strings that include single or double quotes (e.g.
>O'Hara)?

Double the single quotes. A double quote inside single quotes doesn't
need escaping.

junk=# select * from x;
x
----------
O'Hara
Connolly
(2 rows)

junk=# select * from x where x like '%''%';
x
--------
O'Hara
(1 row)

junk=# select * from x where x ~ '''';
x
--------
O'Hara
(1 row)

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"I am crucified with Christ; nevertheless I live; yet
not I, but Christ liveth in me; and the life which I
now live in the flesh I live by the faith of the Son
of God, who loved me, and gave himself for me."
Galatians 2:20

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-03-20 21:38:22 Re: finding and removing a constraint...
Previous Message Matt Magoffin 2001-03-20 21:20:23 trigger inheritence?