[Checkins] SVN: relstorage/trunk/relstorage/adapters/mover.py PostgreSQL 8.1 compatibility: "drop table if exists" is not valid in 8.1.
Shane Hathaway
shane at hathawaymix.org
Sun Jun 26 05:14:25 EDT 2011
Log message for revision 121979:
PostgreSQL 8.1 compatibility: "drop table if exists" is not valid in 8.1.
This required changing "on commit delete rows" to "on commit drop", but
the "on commit delete rows" idea was not actually working anyway, since
"on commit delete rows" fires truncate triggers, not delete triggers.
Note that PostgreSQL 8.1 has reached end of life. It might be wise
to immediately drop compatibility with PG 8.1.
Changed:
U relstorage/trunk/relstorage/adapters/mover.py
-=-
Modified: relstorage/trunk/relstorage/adapters/mover.py
===================================================================
--- relstorage/trunk/relstorage/adapters/mover.py 2011-06-26 00:14:18 UTC (rev 121978)
+++ relstorage/trunk/relstorage/adapters/mover.py 2011-06-26 09:14:24 UTC (rev 121979)
@@ -389,15 +389,17 @@
) ON COMMIT DROP;
CREATE UNIQUE INDEX temp_store_zoid ON temp_store (zoid);
- DROP TABLE IF EXISTS temp_blob_chunk;
CREATE TEMPORARY TABLE temp_blob_chunk (
zoid BIGINT NOT NULL,
chunk_num BIGINT NOT NULL,
chunk OID
- ) ON COMMIT DELETE ROWS;
+ ) ON COMMIT DROP;
CREATE UNIQUE INDEX temp_blob_chunk_key
ON temp_blob_chunk (zoid, chunk_num);
- -- Trigger to clean out oids that did not get copied to blob_chunk
+
+ -- This trigger removes blobs that get replaced before being
+ -- moved to blob_chunk. Note that it is never called when
+ -- the temp_blob_chunk table is being dropped or truncated.
CREATE TRIGGER temp_blob_chunk_delete
BEFORE DELETE ON temp_blob_chunk
FOR EACH ROW
@@ -1010,7 +1012,7 @@
f = None
bytes = 0
-
+
try:
cursor.execute(stmt, (oid, tid))
for chunk_num, loid in cursor.fetchall():
@@ -1092,7 +1094,7 @@
f = None
bytes = 0
- # XXX Current versions of cx_Oracle only support offsets up
+ # Current versions of cx_Oracle only support offsets up
# to sys.maxint or 4GB, whichever comes first.
maxsize = min(sys.maxint, 1<<32)
try:
@@ -1194,7 +1196,7 @@
if use_tid:
params['tid'] = tid
cursor.execute(insert_stmt, params)
-
+
write_chunk_size = self.blob_chunk_size
for i in xrange(maxsize / write_chunk_size):
write_chunk = f.read(write_chunk_size)
@@ -1299,7 +1301,7 @@
"""
f = open(filename, 'rb')
- # XXX Current versions of cx_Oracle only support offsets up
+ # Current versions of cx_Oracle only support offsets up
# to sys.maxint or 4GB, whichever comes first. We divide up our
# upload into chunks within this limit.
maxsize = min(sys.maxint, 1<<32)
More information about the checkins
mailing list