[Zope-DB] insert failing without raising exception: postgresql,
psycopg
freeman at tllc.com
freeman at tllc.com
Tue Nov 22 06:27:42 EST 2005
Problem:
Database inserts that worked previously are now failing,
without raising exceptions!
Request:
Help!
Production Environment:
zope-2.7.4, postgresql-7.4.3p2, psycopg-1.1.15, OpenBSD 3.7.
Duplicated under test environment:
zope 2.7.4, postgresql 8.0.3, psycopg-1.1.15, OpenBSD 3.8.
Details:
When I call the Z SQL method directly, with test data, the database
insert works as expected.
When I call the same method from a python script, the database insert
fails, without raising an exception. I can only tell the insert failed
by looking at the database and seeing that the data was not stored.
Though the insert is failing, a sequence column in the target table is
apparently being incremented by the failing insert. (I deduce this
from the fact that subsequent Z SQL test inserts show sequence gap
of 12 after each failed insert attempt, while no gap occurs when I
call the Z SQL method repeatedly via Zope's "test" tab.)
I will appreciate any suggestions as to how I might troubleshoot this.
Thanks!
- Jerome
psql output showing "gaps" in the sequence number field, corresponding
to the failed inserts:
water=> select meterserial as mser, readingserial as rser, readdate, reading from meterreads where meterserial = 572 and readdate >= '2005-09-01' order by readdate;
mser | rser | readdate | reading [annotation]
------+------+------------+---------
572 | 4382 | 2005-09-02 | 72100
572 | 4383 | 2005-09-09 | 72230
572 | 4384 | 2005-09-16 | 72366
572 | 4385 | 2005-09-23 | 72398
572 | 4386 | 2005-09-30 | 72513
572 | 5681 | 2005-10-01 | 72600
572 | 5726 | 2005-10-02 | 72602 [test before failed insert]
572 | 5738 | 2005-10-03 | 72603 [test after failed insert]
572 | 5739 | 2005-10-04 | 72604 [2nd 'test' in a row]
572 | 5751 | 2005-10-05 | 72605 [test after failed insert]
572 | 5752 | 2005-10-06 | 72606 [2nd 'test' in a row]
572 | 5764 | 2005-10-07 | 72607 [test after failed insert]
572 | 5776 | 2005-10-08 | 72608 [test after failed insert]
(13 rows)
example Z SQL test output:
insert into MeterReads (MeterSerial, ReadDate, Reading
)
values (572,
'2005-10-08',
72608
)
More information about the Zope-DB
mailing list