Re: Special characters - Mailing list pgsql-general

From Oliver Elphick
Subject Re: Special characters
Date
Msg-id 200103202128.f2KLSlG05979@linda.lfix.co.uk
Whole thread Raw
In response to Special characters  ("Mihai Gheorghiu" <tanethq@earthlink.net>)
List 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.Elphick@lfix.co.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



pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Re : overriding default value in inherited column (+ set_value function)
Next
From: "chris markiewicz"
Date:
Subject: RE: finding and removing a constraint...