[Thuban-commits] r2717 - in trunk/thuban: . test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Jan 1 22:44:06 CET 2007


Author: bernhard
Date: 2007-01-01 22:44:05 +0100 (Mon, 01 Jan 2007)
New Revision: 2717

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/test/postgissupport.py
   trunk/thuban/test/test_postgis_db.py
Log:
Adding an explicit WITH OIDS to the create table commands. This fixes tests
that rely on an oid column to be present for postgresql >=8.0.


Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2006-11-06 12:00:12 UTC (rev 2716)
+++ trunk/thuban/ChangeLog	2007-01-01 21:44:05 UTC (rev 2717)
@@ -1,3 +1,9 @@
+2007-01-01 Bernhard Reiter <bernhard at intevation.de>
+	* test/postgissupport.py, test/test_postgis_db.py: adding an 
+	explicit WITH OIDS to the create table commands. This fixes tests
+	that rely on an oid column to be present for postgresql >=8.0.
+	Thanks for Frank Koormann for the hint.
+
 2006-11-06 Didrik Pinte <dpinte at itae.be>
 
 	* libraries/thuban/wxproj.cpp: bugfix - allow compilation with

Modified: trunk/thuban/test/postgissupport.py
===================================================================
--- trunk/thuban/test/postgissupport.py	2006-11-06 12:00:12 UTC (rev 2716)
+++ trunk/thuban/test/postgissupport.py	2007-01-01 21:44:05 UTC (rev 2717)
@@ -712,6 +712,9 @@
 
     srid -- The srid of the spatial references system used by the table
             and the data
+
+    The tables will be explicitely created WITH OIDS. This has been
+    default for PostgreSQL <8.0 and some tests relied on it (end of 2006).
     """
     import dbflib, shapelib
 
@@ -750,7 +753,7 @@
         fields.append(name)
         fields_decl.append("%s %s" % (name, typemap[ftype]))
         insert_formats.append("%%(%s)s" % name)
-    stmt = "CREATE TABLE %s (\n    %s\n);" % (tablename,
+    stmt = "CREATE TABLE %s (\n    %s\n) WITH OIDS ;" % (tablename,
                                               ",\n    ".join(fields_decl))
     cursor.execute(stmt)
     #print stmt

Modified: trunk/thuban/test/test_postgis_db.py
===================================================================
--- trunk/thuban/test/test_postgis_db.py	2006-11-06 12:00:12 UTC (rev 2716)
+++ trunk/thuban/test/test_postgis_db.py	2007-01-01 21:44:05 UTC (rev 2717)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2004, 2005 by Intevation GmbH
+# Copyright (C) 2003, 2004, 2005, 2006 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh at intevation.de>
 #
@@ -106,11 +106,13 @@
                                + self.server.connection_string("admin"))
         cursor = conn.cursor()
         # First a normal table, i.e. one without a geometry column
-        cursor.execute("CREATE TABLE normal (A INT, B VARCHAR);"
+        # we need an explicit WITH OIDS for postgresql >= 8.0
+        cursor.execute("CREATE TABLE normal (A INT, B VARCHAR) WITH OIDS;"
                        "GRANT SELECT ON normal TO PUBLIC;")
 
         # Then a table with a geometry column
-        cursor.execute("CREATE TABLE geo (A INT);"
+        # we need an explicit WITH OIDS for postgresql >= 8.0
+        cursor.execute("CREATE TABLE geo (A INT) WITH OIDS;"
                        "GRANT SELECT ON geo TO PUBLIC;")
         cursor.execute("SELECT AddGeometryColumn(%(dbname)s, 'geo',"
                        " 'the_geom', -1, 'POINT', 2);",



More information about the Thuban-commits mailing list