I have v.4.0.4b max nt, and I have the same result, even more:

mysql> INSERT INTO settest SET chain="A,C";
ERROR 1062: Duplicate entry 'A,C' for key 1
mysql> INSERT INTO settest SET chain="C,A";
ERROR 1062: Duplicate entry 'A,C' for key 1
mysql>

but

mysql> SELECT * FROM settest WHERE FIND_IN_SET('C,A', chain)>0;
Empty set (0.00 sec)

I guess it can be a bug.

-----Original Message-----
From: Lopez David E-r9374c [mailto:r9374c@;motorola.com]
Sent: Thursday, October 24, 2002 5:09 PM
To: Mysql List (E-mail)
Subject: Understanding MySQL column type SET


Gurus

I'm having trouble understanding the column type SET.
To explain my problem, I'll create a table, populate
it, and do selects.


mysql> CREATE TABLE settest( chain SET( "A", "B", "C" ) NOT NULL, 
                      UNIQUE INDEX ichain( chain ) );

mysql> INSERT INTO settest SET chain="A,C";

mysql> SELECT * from settest;
+-------+
| chain |
+-------+
| A,C   |
+-------+

mysql> SELECT * FROM settest WHERE chain="A,C";
+-------+
| chain |
+-------+
| A,C   |
+-------+

mysql> SELECT * FROM settest WHERE chain="C,A";
Empty set (0.00 sec)

 or 

mysql> SELECT * FROM settest WHERE FIND_IN_SET("C,A", chain);
Empty set (0.01 sec)

In reading MySQL Reference Manual, this second select statement 
should work. But in version()=3.23.49-nt-log, it does not. 

In my understanding of set theory, if a SET has A,B,C

  A,C == C,A

Can anyone tell me what I'm missing?

BTW, for my application, I'm only interested in unique entries.
---
David E Lopez

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

 
Attention:
Any views expressed in this message are those of the individual sender, except where 
the message states otherwise and the sender is authorized to state them to be the 
views of any such entity.

The information contained in this message and or attachments is intended only for the 
person or entity to which it is addressed and may contain confidential and/or 
privileged material. Any review, retransmission, dissemination or other use of, or 
taking of any action in reliance upon, this information by persons or entities other 
than the intended recipient is prohibited. If you received this in error, please 
contact the sender and delete the material from any system and destroy any copies.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to