Either this used to work before, or else I was getting lucky with the keys or something. Have you all made changes?
Here is a (sanitized) exerpt from the logs:
Code: Select all
2013-10-29 17:13:55 cat: Execute prepared, proto: postgresql-9, msg: Statement 1
2013-10-29 17:14:00 cat: Execute, proto: postgresql-9, msg: SELECT false
2013-10-29 17:14:00 cat: Prepare, proto: postgresql-9, msg: PREPARE 'INSERT INTO mydatabase.mytable (myrecord_id,"name",[...fields omitted...],fgcolor,bgcolor) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)'
2013-10-29 17:14:00 cat: Execute prepared, proto: postgresql-9, msg: INSERT INTO mydatabase.mytable (myrecord_id,"name",[...fields omitted...],fgcolor,bgcolor) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?), errcode: 0, error: ERROR: duplicate key value violates unique constraint "pk_mytable"
DETAIL: Key (myrecord_id)=(5) already exists.
Now, the first logical question that should come to mind is, If this is a NEW record, where is it getting that key value from anyway? And then the second question is, why is it including the key for the insert when its a SERIAL key?
I've tried it many times and as near as I can tell, the value of the myrecord_id is either random, or else generated internally by the TZQuery component. But the numbers it has come up with are not always consecutive, though they are also not widely spread out either. So I don't know if there is some sort of pattern to it or not.
Everything seems to work in all other respects except for this one. I can retrieve data, modify data, and put it back (update data) without any problems. It is only when I try to insert a new record that I have a problem. (I haven't tried deleting any, thus far).
I'm sure I could hand-craft the Insert query myself, but I'd rather not. The queries are all simple and I'm pretty sure this used to work-- or else I was getting lucky, as I speculated above.
I opened a ticket on this at Sourceforge [https://sourceforge.net/p/zeoslib/tickets/53/]. I'm not sure if this is a bug in the software or a misunderstanding on my part for how to use it.
Any thoughts?
Thanks,
John Whitten