possible wierd boolean bug?

Started by Merlin Moncureabout 21 years ago11 messages
#1Merlin Moncure
merlin.moncure@rcsonline.com

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

#2Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Merlin Moncure (#1)
Re: possible wierd boolean bug?

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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Merlin Moncure
merlin.moncure@rcsonline.com
In reply to: Bruce Momjian (#2)
Re: possible wierd boolean bug?

Bruce wrote:

That is bizarre. Does EXPLAIN show any difference?

------------------------------------------------------------------------
--

esp=# explain analyze 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 ;

QUER
Y PLAN

------------------------------------------------------------------------
----------------------------
------------------------------------------------------------------------
----------------------------
--
Limit (cost=0.00..5.76 rows=1 width=313) (actual time=0.000..0.000
rows=0 loops=1)
-> Index Scan using po_line_file_pkey on po_line_file
(cost=0.00..5.76 rows=1 width=313) (actua
l time=0.000..0.000 rows=0 loops=1)
Index Cond: ((pol_po_no = '00000002'::bpchar) AND (pol_po_no =
'00000002'::bpchar) AND (pol
_po_no = '00000002'::bpchar) AND ((pol_po_rel_no)::smallint = 0) AND
((pol_po_rel_no)::smallint = 0)
)
Filter: ((pol_item_no)::text = '1570'::text)
Total runtime: 0.000 ms
(5 rows)

esp=# explain analyze 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 ;
QUERY
PLAN

------------------------------------------------------------------------
----------------------------
------------------------------------
Limit (cost=0.00..5.75 rows=1 width=313) (actual time=0.000..0.000
rows=1 loops=1)
-> Index Scan using po_line_file_pkey on po_line_file
(cost=0.00..5.75 rows=1 width=313) (actua
l time=0.000..0.000 rows=1 loops=1)
Index Cond: ((pol_po_no = '00000002'::bpchar) AND
((pol_po_rel_no)::smallint = 0))
Filter: ((pol_item_no)::text = '1570'::text)
Total runtime: 0.000 ms
(5 rows)

#4Merlin Moncure
merlin.moncure@rcsonline.com
In reply to: Merlin Moncure (#3)
Re: possible wierd boolean bug?

That is bizarre. Does EXPLAIN show any difference?

Uh oh.

esp=# reindex table data1.parts_order_line_file;
REINDEX
esp=# explain analyze 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 ;

QUER
Y PLAN

------------------------------------------------------------------------
----------------------------
------------------------------------------------------------------------
----------------------------
--
Limit (cost=0.00..5.76 rows=1 width=313) (actual time=0.000..0.000
rows=0 loops=1)
-> Index Scan using po_line_file_pkey on po_line_file
(cost=0.00..5.76 rows=1 width=313) (actua
l time=0.000..0.000 rows=0 loops=1)
Index Cond: ((pol_po_no = '00000002'::bpchar) AND (pol_po_no =
'00000002'::bpchar) AND (pol
_po_no = '00000002'::bpchar) AND ((pol_po_rel_no)::smallint = 0) AND
((pol_po_rel_no)::smallint = 0)
)
Filter: ((pol_item_no)::text = '1570'::text)
Total runtime: 0.000 ms
(5 rows)

#5Merlin Moncure
merlin.moncure@rcsonline.com
In reply to: Merlin Moncure (#4)
Re: possible wierd boolean bug?

That is bizarre. Does EXPLAIN show any difference?

Uh oh.

esp=# reindex table data1.parts_order_line_file;

whoops, never mind that. In fact, I re-indexed the wrong table.
Reindexing makes no difference. Here, explain analyze and running query
in psql return different results. Observe:

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 ;
int4 | id | lastmod | pol_po_no | pol_po_rel_no | pol_seq_no |
pol_parts_unit_no | pol_item_no | po
l_desc1 | pol_desc2 | pol_vendor_part_no | pol_qty_ordered |
pol_est_cost | pol_purchase_uom | pol_w
eight | pol_requested_date | pol_expected_date | pol_plant_loc_needed |
pol_workstation_needed | pol
_stock_loc_needed | pol_internal_contact | pol_update_unit_cost |
pol_gl_acct_no | pol_pur_to_inv_ra
tio | pol_print_rev_no | pol_revision_flag | pol_qty_received |
pol_parts_tracking_flag | pol_qty_re
jected
------+----+---------+-----------+---------------+------------+---------
----------+-------------+---
--------+-----------+--------------------+-----------------+------------
--+------------------+------
------+--------------------+-------------------+----------------------+-
-----------------------+----
------------------+----------------------+----------------------+-------
---------+------------------
----+------------------+-------------------+------------------+---------
----------------+-----------
-------
(0 rows)

esp=# explain analyze 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 ;

QUER
Y PLAN

------------------------------------------------------------------------
----------------------------
------------------------------------------------------------------------
----------------------------
--
Limit (cost=0.00..5.79 rows=1 width=313) (actual time=0.000..0.000
rows=0 loops=1)
-> Index Scan using po_line_file_pkey on po_line_file
(cost=0.00..5.79 rows=1 width=313) (actua
l time=0.000..0.000 rows=0 loops=1)
Index Cond: ((pol_po_no = '00000002'::bpchar) AND (pol_po_no =
'00000002'::bpchar) AND (pol
_po_no = '00000002'::bpchar) AND ((pol_po_rel_no)::smallint = 0) AND
((pol_po_rel_no)::smallint = 0)
)
Filter: ((pol_item_no)::text = '1570'::text)
Total runtime: 0.000 ms
(5 rows)

#6Merlin Moncure
merlin.moncure@rcsonline.com
In reply to: Merlin Moncure (#5)
2 attachment(s)
Re: possible wierd boolean bug?

I confirmed the problem on a linux server running beta3...so this
problem is quite reproducible by running the attached scripts on a
freshly loaded database.

To reproduce the problem [adjust host,etc as necessary]:
1. type/cat test_boolean.sql | psql template1 (this will create a
database called 'test', connect to it, and load a few things.)
2. bzip -cd < poline.bzip | psql test (this will load a table into test
that was dumped via pg_dump)
3. try the following query:
select 1::int4, * from data1.po_line_file
where pol_po_no = '00000002' and
(pol_po_no = '00000002' and pol_po_rel_no = 0) and
(pol_po_no = '00000002' and pol_po_rel_no = 0 and
pol_item_no = '1570');

it should return 0 rows.

Try it with explain/analyze which reports 4 rows.
Try it a third time as:

select 1::int4, * from data1.po_line_file
where -- pol_po_no = '00000002' and
-- (pol_po_no = '00000002' and pol_po_rel_no = 0) and
(pol_po_no = '00000002' and pol_po_rel_no = 0 and
pol_item_no = '1570');

which is logically equivalent to the first form (isn't it?) and this
returns 1 row (the correct answer).

Merlin

Attachments:

test_boolean.sqlapplication/octet-stream; name=test_boolean.sqlDownload
poline.bzipapplication/octet-stream; name=poline.bzipDownload
BZh91AY&SYA/s�p�z:By��?�������`^^o>�������a���y�wl�%p;M�aP���m��
b��voyF�RH���Q�5���,!$I�d��!C
OP���2�z�S4@�4!��HJy)�hd�F��~�(F��	4� ���M4CC#PG�a
���L5M����H������F�"H!4"jxJ��
�����*���(`,��_d	IDE����9�_o���J��{�mmm�
������\��9v��S��F�t.5�u;`���rw'�vE�Yx����W��y+�(�|y$;#��y��P�h�O�X�L����3����[��w^,a��
��JT��U�\�V��dt[.�	�.�Q�����Ib�J��%*�r����	@y�������p;������|#�f����H���k5H� ��eQ|�"W� <��9��	�"C#L���X� ��x� w�H��w�PBd	Y��LV�H�HE��	"���yT���Dv|+i��H���R��&��Z�|�O�j�RsY�Jre��U���������)C3
�/T�����vN�[(2�3V�Tc��)�<D���#��5�(!����dX"]f���[q�q��'}l�z���+p����Kh�R��B�i�2����0��.d1
���$������~5���K����/S�z���lO9}b��#Y(�X���{&)������i5��n�MS��!�po.l��kL2���0pM�	E�
Cj<L�]����2
�p����������w�����9������8�r�RG&�0����j�u���[dn����_iUf<�<�0r���1�Y�pl1O�I^���?^�g��P�;V��z=���7����VF[8�Z��6��	�>cC�`9� w�s;`}�}�;�q����T,uh�2KM��^��bV�R���3��O.u�� ��3��UT*��
�������t~|�5o���[��$���J>���������N��6Zk-:��q�
�������fzZ8y���m&�5��h/�KeC���L8��0���5��t��5�U��'��H��s2�W���c���K��9����\���:�����Q�}�HCV�N<{^�������y������[Vq�����W	���F@$M��*�a����Tx����R��c%�)'�!P@ IY��A�pp���}��z����^}5�3�q�`��4���I�ijsmjXsFPy����:<�'.����z���f�H(=����<z�y�E
��KM��V��������QX`���J":����!(mN���H�|pMm�=c,|��������� H~���%���'��P���FAT,���4����2T9#��$��Od�:gUAC �uB�r�I���h��}a�� ������4G���E.�����n�^�t���%�8UY,�x7����a,����Uu��^}��]$���{mp\&���}�}�w�*4@��0rk2����V��dGM�(�d.�[;�����"-��W:�,K�(T	�}/�w�X�q��� g�yh��V�TX���:D.Rq���}�����qg�Y}%��;�g�D��^�q5����t�I%�x^�P9��]k�>�>4�B~��}L�5�@D���g��
HBHB\,j��0&ABu'	��O�^D�wF]�T��c+�����N�(��z�����/���>��D$'e���: fw_dZ�J�_~����,$)BSS��# @ZDe�
�w�|�K[�dq�>�F������%d�l1�3-����b�Xa+&�3Y].�V+l���Q���k
�*�a�\�"*��IQd%a��DlT&0b�$RE����0��a�E���L�Z����(������(#L�)A��}�.�A����"{���>�L�a�TB�D�X�dYGD@"/1lc���_������.=���,$���%��2@8C	#���|U�35f���ml9m3�;��;&u���&i�sU ��`-�E�p�)�5U*��!1B�`�r
#�#t
�����3��3!��k]�v�L�2��4�QQ���f�b��7We��]hs�4�������U@WY��Zc��b��(�F@��Sr�@I��W�"f&B�d��WT$$����A`nn� zf���,d)�q��F��r���&�^aQ,/��Q��;���p
JE�[��
�bX���\!���
�L%�����.)���X���@iK�b��
���6F�
X�.-�]��G`���E,�����d���M�j����Q��a��]�X@�(Az��T07���?�����m�������2�s�p��iM�t����s�<m���0	[�@@�l�D�)�=��`���S��,T�D.��kG-�T�5
�oF.q��
�a���>�J��P`A������+��������l�md�M��]��I0��
�j0B�X�;���6��� �=�������a6B!��@�����0&�k$d����N��o��;�2��T7�V9j��P����Hr�XwE�@�;v�4+k��X0����d��t��F���������P����w{��h{�^0=�����yt�l&�D$
������.r���`� !@�z$
m�C�y��9���%�E���T �P�+���Z���n���p��`�M��qN���i�Hx[��{�VZ��X�.$K/d��Cl��(�u{�0�;D���3��|Z�D�$�:�p��e�t�F&���'}�`cN�d��V�hW����H�P���]�w�}P��������3lb�����b��_,Sz��������I�q���c-�H/��X�����{g%co[c�s�&1d%T�S�����w�S5��Cp
Jy�Q����[%Tk�)��4G-b��Lu��M6���n���1���8�7����^��6�M��5o�r�T��9�|�pml�m�$Hk��s��r����"m�^��9���������q8N��a9�6�&Z���:i��s���_�>TBnj��	�wu���y�:R*��i�Pw����m�$!���&�C�K}����	 �?�<�#��������(�^�G�m}�
0oAt�r��B��R���.l:�lc(���t;����������8��s�g���b���-	(HhK����&��/��-�i�����vd��L��!7[*��sK���r��	�Y2��*,�@(�>/��F�E�n�d��6GH�7�s� �@���a5�Y6����K����y�]sX���s��kI�����kU�Z�L�)%��P��a�~������t�X� 6o/�~�/{�;j�,�0�87H9�t;�����a�{&��;�����I� ���l*AH) ���]8AH)
�@�� ��D�"s��S�uM�.�oM�s)d�))���m����
������fY%��2hd�>�����b����	��j�Q"���h���nJ[���Rf&mW�K�<�6�l8a`�z�G�gGa�z�\$��o�$]�@(�7�;���}���!��t�����W�c}��+�(��gefQ��J!$����x.���=���E
��jC�5	�a�8��VL�ozE.91d��M�����@�R�I��!i3CN����$ts��xp�zdn�����"z�SX�B
������ C�+]l������+�#��n�������dH�����&	x�8�B?>'���P���^���@��p	p��
���q�K:;r*������I�C�`V��Z������[q����p�z��X|"���f���49g�a�ub<0�E���	��@�C�4/z�C+�����:x������l9����|P>H����� |C}�;|�I�3��"�EW�!L������j�	�A�.@��/ f�[��<Hh>�l@����B��/����ji����S�b���M���=�}��a�X[��n�dLe�G�!����Aw�������R)��{���3�t�o��!;�p>�A�����_6�`_�o���;�
 rG�":�v�%��x�����tC+b�z���%��o1���t�����Fz��/�"8���-�K����s��1�Gt`9�z=;�:R���]�x����~;��G%��uC�1S8����~��,��P��7aW�g07�_
��2��6
��4Qw�\���%��"�H��������
DZv���_�T{z�tc�����4���a� �x�/�%G!��}������Xx�qD~��o�.z���vBP�����N�`{M���w[���9'�;���)d9l�oB=�o�@�=�qH���{u��t
���c������@n�Rf"�2��b��P�`V��RB,��%
Bw����G�����	"6G�}�����cj/���I��ph�X2����v�B;Z��B���.m�}����G���q=��G$���Q��\'H�l,�o}De��d6�U ��#X�@�>�����.��#�Pt����k���z��g�,a��	^~��7������4�{�������g4���������X���p"���N����g�d�*�������|�.@7��9.����Gr�H�+��(@��������'�e��|�O��v8�	���u�	�D�.�^���*��2g�����t��m�Y�� ��K���Q|�7��������������>R������/
��d������HB	���O��p,Eo8��3%����`K��)���c
�E%'8�r?�0"t��61�V���\X�7
NB���Y�;JH���<��c����b@�X,���[�y7D�4]���L������*G!����7�K���y�������(s��6/�\������N1�1���
����
��H���B�������C�"���V�*,�C�R�.��7���NgSe
���N���pq������[-��J1�d;��.�����0�U����0�I�8 ���*u8p�����Hr�^r,	��d:|����@�r�1	�<UUUW��\�ep�e�����*���F�V���J�;����e��l�}8.9>$-��>&P8}�b4|8>��������j�����V��v-$��p~is��B����������}wSA�`����-O�XXNc�����"�(H ���
#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Merlin Moncure (#6)
Re: possible wierd boolean bug?

"Merlin Moncure" <merlin.moncure@rcsonline.com> writes:

Try it with explain/analyze which reports 4 rows.

I don't see four rows. I do see different results when I add the third
redundant WHERE clause: it switches to a different index and fails to
find the row it should find. I suspect the problem is located in the
btree index scan setup code that I changed to support cross-data-type
comparisons. (7.4 does not fail, but it doesn't try to use the index
fully either.)

I'm on it... thanks for the test case!

regards, tom lane

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Merlin Moncure (#6)
Re: possible wierd boolean bug?

Got it: _bt_preprocess_keys is setting keys_are_unique in cases where it
shouldn't. The test at the bottom of that routine used to be correct,
but no longer is, because the number of keys returned could be more than
the number of attributes being tested when redundant cross-data-type quals
are provided (see the comments above the routine).

A fix will be forthcoming.

regards, tom lane

#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Merlin Moncure (#6)
Re: possible wierd boolean bug?

"Merlin Moncure" <merlin.moncure@rcsonline.com> writes:

I confirmed the problem on a linux server running beta3...so this
problem is quite reproducible by running the attached scripts on a
freshly loaded database.

The attached patch fixes the problem for me.

regards, tom lane

*** src/backend/access/nbtree/nbtutils.c.orig	Sun Aug 29 01:06:40 2004
--- src/backend/access/nbtree/nbtutils.c	Wed Dec 15 14:00:59 2004
***************
*** 224,234 ****
  	BTScanOpaque so = (BTScanOpaque) scan->opaque;
  	int			numberOfKeys = scan->numberOfKeys;
  	int			new_numberOfKeys;
  	ScanKey		inkeys;
  	ScanKey		outkeys;
  	ScanKey		cur;
  	ScanKey		xform[BTMaxStrategyNumber];
- 	bool		allEqualSoFar;
  	bool		hasOtherTypeEqual;
  	Datum		test;
  	int			i,
--- 224,234 ----
  	BTScanOpaque so = (BTScanOpaque) scan->opaque;
  	int			numberOfKeys = scan->numberOfKeys;
  	int			new_numberOfKeys;
+ 	int			numberOfEqualCols;
  	ScanKey		inkeys;
  	ScanKey		outkeys;
  	ScanKey		cur;
  	ScanKey		xform[BTMaxStrategyNumber];
  	bool		hasOtherTypeEqual;
  	Datum		test;
  	int			i,
***************
*** 278,284 ****
  	 * Otherwise, do the full set of pushups.
  	 */
  	new_numberOfKeys = 0;
! 	allEqualSoFar = true;
  	/*
  	 * Initialize for processing of keys for attr 1.
--- 278,284 ----
  	 * Otherwise, do the full set of pushups.
  	 */
  	new_numberOfKeys = 0;
! 	numberOfEqualCols = 0;

/*
* Initialize for processing of keys for attr 1.
***************
*** 321,327 ****
*/
if (i == numberOfKeys || cur->sk_attno != attno)
{
! bool priorAllEqualSoFar = allEqualSoFar;

  			/* check input keys are correctly ordered */
  			if (i < numberOfKeys && cur->sk_attno != attno + 1)
--- 321,327 ----
  		 */
  		if (i == numberOfKeys || cur->sk_attno != attno)
  		{
! 			int			priorNumberOfEqualCols = numberOfEqualCols;

/* check input keys are correctly ordered */
if (i < numberOfKeys && cur->sk_attno != attno + 1)
***************
*** 355,368 ****
xform[BTLessEqualStrategyNumber - 1] = NULL;
xform[BTGreaterEqualStrategyNumber - 1] = NULL;
xform[BTGreaterStrategyNumber - 1] = NULL;
}
else
{
! /*
! * If no "=" for this key, we're done with required keys
! */
! if (!hasOtherTypeEqual)
! allEqualSoFar = false;
}

  			/* keep only one of <, <= */
--- 355,368 ----
  				xform[BTLessEqualStrategyNumber - 1] = NULL;
  				xform[BTGreaterEqualStrategyNumber - 1] = NULL;
  				xform[BTGreaterStrategyNumber - 1] = NULL;
+ 				/* track number of attrs for which we have "=" keys */
+ 				numberOfEqualCols++;
  			}
  			else
  			{
! 				/* track number of attrs for which we have "=" keys */
! 				if (hasOtherTypeEqual)
! 					numberOfEqualCols++;
  			}

/* keep only one of <, <= */
***************
*** 411,417 ****
* If all attrs before this one had "=", include these keys
* into the required-keys count.
*/
! if (priorAllEqualSoFar)
so->numberOfRequiredKeys = new_numberOfKeys;

  			/*
--- 411,417 ----
  			 * If all attrs before this one had "=", include these keys
  			 * into the required-keys count.
  			 */
! 			if (priorNumberOfEqualCols == attno - 1)
  				so->numberOfRequiredKeys = new_numberOfKeys;

/*
***************
*** 468,475 ****
* If unique index and we have equality keys for all columns, set
* keys_are_unique flag for higher levels.
*/
! if (allEqualSoFar && relation->rd_index->indisunique &&
! relation->rd_rel->relnatts == new_numberOfKeys)
scan->keys_are_unique = true;
}

--- 468,475 ----
  	 * If unique index and we have equality keys for all columns, set
  	 * keys_are_unique flag for higher levels.
  	 */
! 	if (relation->rd_index->indisunique &&
! 		relation->rd_rel->relnatts == numberOfEqualCols)
  		scan->keys_are_unique = true;
  }
#10Merlin Moncure
merlin.moncure@rcsonline.com
In reply to: Tom Lane (#9)
Re: possible wierd boolean bug?

"Merlin Moncure" <merlin.moncure@rcsonline.com> writes:

I confirmed the problem on a linux server running beta3...so this
problem is quite reproducible by running the attached scripts on a
freshly loaded database.

The attached patch fixes the problem for me.

regards, tom lane

Yup. I just confirmed it from cvs. btw, the 4 rows I was complaining
about was due to my erroneously reading the analyze output, so
everything works ok now. Thanks!

Anyways, it would be nice to be able to use the sql row constructor to
do equality/comparison...wouldn't get caught writing such silly sql
statements :)

Merlin

#11Tom Lane
tgl@sss.pgh.pa.us
In reply to: Merlin Moncure (#10)
Re: possible wierd boolean bug?

"Merlin Moncure" <merlin.moncure@rcsonline.com> writes:

Anyways, it would be nice to be able to use the sql row constructor to
do equality/comparison...wouldn't get caught writing such silly sql
statements :)

You mean like this?

regression=# select row(1,2,3) = row(1,2,3);
?column?
----------
t
(1 row)

regression=# select row(1,2,3) = row(1,2,4);
?column?
----------
f
(1 row)

The semantics aren't right yet for non-equality comparisons, but it
works fine for = and != ...

regards, tom lane