PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #2068

sequence problem when another unique index exists

Details

Submitted2004-08-05 14:05 UTC
Fromdaniel at konczyk dot net
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version4.3.4
OSDebian GNU/linux
Roadmaps(Not assigned)

Comments

[2004-08-05 14:05 UTC] 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...?

[2004-08-06 12:36 UTC] naveen at dittakavi dot com

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