DB bug (pear.php.net down) was Re: [PEAR-BUG] Bug #2068 [Com]: sequence problem when another unique index exists
| From: | Alan Knowles | Date: | Sat, 07 Aug 2004 01:47:20 +0000 |
| Subject: | DB bug (pear.php.net down) was Re: [PEAR-BUG] Bug #2068 [Com]: sequence problem when another unique index exists | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32500@lists.php.net to get a copy of this message | ||
This one needs reassigning to DB as critical when pear.php.net comes back up.
his was caused by a change in the Postgres Backend which seriously broke BC!!!!!!!!!!!
http://cvs.php.net/diff.php/pear/DB/DB/pgsql.php?r1=1.47&r2=1.48&ty=h&num=10
Block from line 620
line
consider changing
$flags .= 'default_' . rawurlencode($num) . ' ';
to
$flags .= 'default_' .str_replace(' ','_',$num) . ' ';
Regards
Alan
naveen at dittakavi dot com wrote:
Edit report at http://pear.php.net/bugs/bug.php?id=2068&edit=1ID: 2068 Comment by: naveen at dittakavi dot com Reported By: daniel at konczyk dot net Status: Open Type: Bug Package: DB_DataObjectOperating System: Debian GNU/linuxPHP Version: 4.3.4New Comment: Hi Daniel, That's funny. I just ran into this same issue. I spent about an hour looking into it and see that we must override sequenceKey() in our DB_tablename file to return array(false, false). Here's our fix: class DataObjects_"tablename" extends DB_DataObject { #autocode ... #end autocode function sequenceKey() { return array(false, false); }//end function }//end class You'll need to do this for each class that you have already defined a sequence and have set the default value nextval for. Let me know if this doesn't help. - Naveen Previous Comments: ------------------------------------------------------------------------ [2004-08-05 10:05:01] daniel at konczyk dot net Description: ------------ I use the latest DB_DataObject This is postgresql issue, here how it looks here and why it doesn't work: I have a table with 4 columns, id, col1, col2, col3 id has default value nextval('sometable_seq') + primary_key flag I have a multiple unique index on the rest 3 columns Generator treats all the 4 columns as KEYS, and so mark them as K in the database.ini file. The rusult of the insert query on that table is 'No Data specified for query' If I drop the unique index, everythig works fine Isn't that a mistake, that the columns are treated as Keys, although if I've already specified table's primary key...? ------------------------------------------------------------------------