Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TXUiS-0006K9-Pt for pgsql-sql@postgresql.org; Sun, 11 Nov 2012 10:24:37 +0000 Received: from outmail148113.authsmtp.com ([62.13.148.113]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TXUiN-0002PA-W8 for pgsql-sql@postgresql.org; Sun, 11 Nov 2012 10:24:36 +0000 Received: from mail-c193.authsmtp.com (mail-c193.authsmtp.com [62.13.128.118]) by punt10.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id qABAOTY7030013; Sun, 11 Nov 2012 10:24:29 GMT Received: from ayaki.localdomain (124-148-90-153.dyn.iinet.net.au [124.148.90.153]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2) with ESMTP id qABAONIq050146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 11 Nov 2012 10:24:26 GMT Message-ID: <509F7CD7.1080009@2ndQuadrant.com> Date: Sun, 11 Nov 2012 18:24:23 +0800 From: Craig Ringer Organization: 2nd Quadrant User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: pantelis vlachos CC: pgsql-sql@postgresql.org Subject: Re: find sudstring on text (data type) field failure References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Server-Quench: f893dc64-2be9-11e2-95c0-002264978518 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZeVg0b BQteCiN5VAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFaQRbY1ZH HGQLWlZEUV17W2d/ aQ0fbAdZfEtKVxtj UFZIR1FNFgBqBAMA SF9vIGgNCXwHeHtw ZEJkEHNTXkw0I050 QRoHE2kbZzU1YX0e URVaagpRIwNXfh9H aFZ7XXQFZGQPKBg1 TUcABAkVCH1RKSJZ ChoQIUkOW0cNEXY7 QVgeECUzVQ0JTjk6 ZwA3MlNdVEgQP0E+ eVUoWFYFKRJ6 X-Authentic-SMTP: 61633235383639.1014:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 124.148.90.153/2525 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201211/4 X-Sequence-Number: 36937 On 11/07/2012 04:36 PM, pantelis vlachos wrote: > 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) Nowhere near enough information. I'd say you have concurrency issues; at the time you ran the query there weren't actually matching rows. See if you can put together a test case that demonstrates the issue, or follow up with a lot more detail.