Thread: find sudstring on text (data type) field failure
I was trying to find a substring on a text (data type) column like 'cat foo dog ...'. <br />I use the query below<br />SELECTid FROM table WHERE name LIKE '% foo %';<br />Sometimes the query return with nTuples=0 but there are matching rows.<br/> On retry, the query return with expected results. Any ideas;<br /><br />(postgres ver 9.2, libpq - C Library)<br/>
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.
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Giasou Panteli,<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px;margin-right:0px; -qt-block-indent:0; text-indent:0px; "> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">are you suggesting that the resultsare incinsistent and unpredictable with every run?<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">pls present a case demontsrating the problem.<pstyle="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0;text-indent:0px; "> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0;text-indent:0px; -qt-user-state:0;">On Τετ 07 Νοε 2012 10:36:34 pantelis vlachos wrote:<br /><p style="margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Iwas trying to find a substring on a text (data type) column like 'cat foo dog ...'. <br />I use the querybelow<br />SELECT id FROM table WHERE name LIKE '% foo %';<br />Sometimes the query return with nTuples=0 but thereare matching rows.<br />On retry, the query return with expected results. Any ideas;<br /><br />(postgres ver 9.2, libpq- C Library)<br /><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0;text-indent:0px; -qt-user-state:0;"><br /><br /><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-<p style=" margin-top:0px; margin-bottom:0px;margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Achilleas Mantzios<pstyle=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;-qt-user-state:0;">IT DEPT