find a substring on a text (data type) column

From: pantelis vlachos <vlachos83(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: find a substring on a text (data type) column
Date: 2012-11-08 07:49:20
Message-ID: CAAYHi_dN5NGx4oEfM1kUjx7H897TE6KVQ-rsWQ9H9z7LMgn-PQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I was trying to find a substring on a text (data type) column like 'cat foo
dog ...'.
I use the query below
SELECT id FROM table WHERE name LIKE '% foo %';
Sometimes the query return with nTuples=0 but there are matching rows.
On retry, the query return with expected results. Any ideas;

(postgres ver 9.2, libpq - C Library)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2012-11-08 07:55:24 Re: find a substring on a text (data type) column
Previous Message 高健 2012-11-08 07:41:00 Use order by clause, got index scan involved