]> granicus.if.org Git - postgis/commitdiff
Change sequence handling to respect versions prior to 7.3. Patch from
authorPaul Ramsey <pramsey@cleverelephant.ca>
Sun, 17 Aug 2003 19:00:14 +0000 (19:00 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Sun, 17 Aug 2003 19:00:14 +0000 (19:00 +0000)
strk.

git-svn-id: http://svn.osgeo.org/postgis/trunk@289 b70326c6-7e19-0410-871a-916f4a2858ee

loader/Makefile
loader/shp2pgsql.c

index 98a9e92f347076dbb5d6d19527032eebc13865b2..376ff9b2f571214822878c824e6c04f2021577f3 100644 (file)
@@ -23,7 +23,23 @@ endif
 
 OBJS = shpopen.o dbfopen.o getopt.o
 
-override CPPFLAGS := -I$(srcdir) -I$(top_builddir)/src/interfaces/libpq $(CPPFLAGS) -DFRONTEND -DSYSCONFDIR='"$(sysconfdir)"'
+#---------------------------------------------------------------
+# Test the version string and set the USE_VERSION macro
+# appropriately.
+#
+ifneq ($(findstring 7.1,$(VERSION)),)
+       USE_VERSION=71
+else
+       ifneq ($(findstring 7.2,$(VERSION)),)
+                USE_VERSION=72
+       else
+                USE_VERSION=73
+       endif
+endif
+
+#---------------------------------------------------------------
+
+override CPPFLAGS := -I$(srcdir) -I$(top_builddir)/src/interfaces/libpq $(CPPFLAGS) -DFRONTEND -DSYSCONFDIR='"$(sysconfdir)"' -DUSE_VERSION=$(USE_VERSION)
 
 all: shp2pgsql$(EXE) pgsql2shp$(EXE)
 
index 5e1e7ff1a713b72a134459fa553bd185b6a19c35..eee6dd7622d01ae970ff2c7ab905dd6639a29cc4 100644 (file)
  * 
  **********************************************************************
  * $Log$
+ * Revision 1.39  2003/08/17 19:00:14  pramsey
+ * Change sequence handling to respect versions prior to 7.3. Patch from
+ * strk.
+ *
  * Revision 1.38  2003/08/05 16:28:05  jeffloun
  * Removed the setval for the sequence if the value was going to be 0.
  * This avoids a warning that occirs when you try to set it to 0.
@@ -1450,7 +1454,12 @@ int main (int ARGC, char **ARGV){
        if(opt != 'a'){
                printf("\nALTER TABLE ONLY %s ADD CONSTRAINT %s_pkey PRIMARY KEY (gid);\n",table,table);
                if(j > 1){
+#if USE_VERSION > 72
                        printf("SELECT pg_catalog.setval ('%s_gid_seq', %i, true);\n",table, j-1);
+#else
+                       printf("SELECT setval ('%s_gid_seq', %i, true);\n",table, j-1);
+#endif
+
                }
        }