From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: possible wierd boolean bug? |
Date: | 2004-12-13 18:24:19 |
Message-ID: | 200412131824.iBDIOJR28593@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
That is bizarre. Does EXPLAIN show any difference?
---------------------------------------------------------------------------
Merlin Moncure wrote:
> I have a strange but reproducible problem where a query does not seem to
> return the same results.
>
> esp=# select 1::int4, * from data1.po_line_file
> esp-# where pol_po_no = '00000002' and
> esp-# (pol_po_no = '00000002' and pol_po_rel_no = 0) and
> esp-# (pol_po_no = '00000002' and pol_po_rel_no = 0 and
> pol_item_no = '1570')
> esp-# limit 1 ;
> [fields omitted]
> (0 rows)
>
> esp=# select 1::int4, * from data1.po_line_file
> esp-# where --pol_po_no = '00000002' and
> esp-# --(pol_po_no = '00000002' and pol_po_rel_no = 0) and
> esp-# (pol_po_no = '00000002' and pol_po_rel_no = 0 and
> pol_item_no = '1570')
> esp-# limit 1 ;
> [fields omitted, note commented redundant clauses]
> (1 row)
>
> The obviously silly Boolean clause here was sql that was generated by a
> driver. I recoded the driver to make more intelligent sql and now the
> problem is gone, at least from my application. Note that the same query
> form but with different tables/fields works correctly 99.99999% of the
> time, just not this time...I'm just curious as to how two seemingly
> equivalent statements could produce different results...perhpaps I
> missed something?
>
> Merlin
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Bernd Helmle | 2004-12-13 20:20:59 | Re: Port report: Fedora Core 3 x86_64 |
Previous Message | Tom Lane | 2004-12-13 17:16:05 | Re: join selectivity |