I do not think this should raise either an error nor a warning. In Sybase, what does the SQL statement return when run in the SQL tool (iSQL?)? Does it return 1 row, or both rows? Further, how would the DBD driver determine what the user really is looking for and what, if any is the PK in this query?
I believe that the coding should be left to the developer. Hopefully he/she understands the data and can write code that will solve the problem at hand. ----------------- Ron Reidy Lead DBA Array BioPharma, Inc. -----Original Message----- From: Avis, Ed [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 13, 2005 3:34 AM To: [email protected] Subject: selectall_hashref() when key field not unique It's not documented what selectall_hashref() will do when the key field or fields you've chosen are not unique. For example (Sybase SQL): $dbh->selectall_hashref( 'select 5 as a, 6 as b union select 5 as a, 7 as b', 'a' ); Here there are two rows with the same value for column 'a'. Personally, I think it should raise an error in this situation, since the programmer is probably expecting the key fields to be unique and if they're not then there is a wrong assumption somewhere. However, that would break compatibility with the current behaviour (even though that behaviour is not documented). So maybe just change the documentation from 'one row, at most' to state explicitly that the first row returned from the database is the one chosen, or something like that. -- Ed Avis <[EMAIL PROTECTED]> This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
