BUG #6499: query to get data with single quote

Lists: pgsql-bugs
From: sujatha(dot)pelluru(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6499: query to get data with single quote
Date: 2012-03-01 10:58:08
Message-ID: E1S33i4-0008TT-5h@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 6499
Logged by: Sujatha
Email address: sujatha(dot)pelluru(at)gmail(dot)com
PostgreSQL version: 9.1.3
Operating system: Linux
Description:

Hi

I have column(string datatype) has a data starting with single quote as
below

'single resource to avoid all job execution'

Now I want write select query to select records which starts with single
quote.

I tried with many option however could not get the result.

Please suggest me how I can frame query.

Thanks
Sujatha


From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <sujatha(dot)pelluru(at)gmail(dot)com>,<pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6499: query to get data with single quote
Date: 2012-03-01 16:58:56
Message-ID: 4F4F56700200002500045D63@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

<sujatha(dot)pelluru(at)gmail(dot)com> wrote:

> I have column(string datatype) has a data starting with single
> quote as below
>
> 'single resource to avoid all job execution'
>
> Now I want write select query to select records which starts with
> single quote.
>
> I tried with many option however could not get the result.

This is not a bug. For help with a question like this, please send
an email to one of the other lists, like pgsql-general or
pgsql-novice.

http://www.postgresql.org/community/lists/

To include an apostrophe in a string literal, double it. Try:

SELECT * FROM tblname WHERE colname LIKE '''%';

-Kevin