Home » Database » DB_DataObject » Bug #970
"No Data specifed for query" with postgresql and unique constraints
Details
| Submitted | 2004-03-08 11:04 UTC |
|---|---|
| From | daniel at konczyk dot net |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | 4.3.3 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2004-03-08 11:04 UTC] daniel at konczyk dot net
Description:
------------
I'm using dataobject 1.5.3, postgresql 7.3.4, php 4.3.3
So far, everything worked OK, recently, I decided to add a unique constraints for some fields, so the user won't add duplicate records (eg. be accident, since he knows, there shall not be any duplicates)
I know, that I could do it, using php and additional queries etc, but I wanted to move the job to postgresql.
I haven't tracked the bug yet, I turned debug on and I theerror message was: "ERROR: update: No Data specifed for query"
When I removed a unique constraint, everything worked fine on the same table (though, I was able to add duplicates, naturally)
With unique constraint, I can't neither insert a record nor update existsing one...Well, I'll remove all the constraints for now...
[2004-03-08 12:16 UTC] daniel at konczyk dot net
Well, I got very simple table, id and word fields
id has a default nextval('blabla_sq')
Now, it works as it is, but when I add unique constraint to word, it doesn't
the keys() method returns
Array ( [0] => id )
and sequenceKey() method returns
Array ( [0] => id [1] => [2] => )
the same without constraint...
[2004-03-08 12:48 UTC] daniel at konczyk dot net
Well, the structure looks pretty ok for me:
var $__table = 'jedn_struktura_typ_sl'; // table name
var $id; // int4(4) not_null default_nextval(jedn_struktura_typ_sl_seq::text) unique primary
var $word; // varchar(-1) not_null unique
I guess you're right, that the additional unique might be breaking something..but I haven't figure out that yet...
[2004-03-10 09:06 UTC] daniel at konczyk dot net
Sure Alan, here it goes
create sequence items_seq;
create table(
id int not null primary key default nextval('items_seq'),
word varchar(100) not null constraint word_unique unique);
[2004-03-10 09:11 UTC] daniel at konczyk dot net
Sure Alan, here it goes
create sequence items_seq;
create table(
id int not null primary key default nextval('items_seq'),
word varchar(100) not null constraint word_unique unique);
[2004-03-10 09:26 UTC] daniel at konczyk dot net
Sure Alan, here it goes
create sequence items_seq;
create table(
id int not null primary key default nextval('items_seq'),
word varchar(100) not null constraint word_unique unique);
[2004-03-12 15:19 UTC] daniel at konczyk dot net
I'll try it today or the weekend, couldn't do that earlier
[2004-03-15 10:22 UTC] daniel at konczyk dot net
Hey Alan
I tried the CVS version as you suggested - works like a charm.
I gave it a try with multiple unique constraints too, no problems with these as well.