From: Paul Ramsey Date: Sun, 17 Aug 2003 19:00:14 +0000 (+0000) Subject: Change sequence handling to respect versions prior to 7.3. Patch from X-Git-Tag: pgis_0_8_0~93 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c73f5b2603261326b8bbd261c81763009d3a71a0;p=postgis Change sequence handling to respect versions prior to 7.3. Patch from strk. git-svn-id: http://svn.osgeo.org/postgis/trunk@289 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/loader/Makefile b/loader/Makefile index 98a9e92f3..376ff9b2f 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -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) diff --git a/loader/shp2pgsql.c b/loader/shp2pgsql.c index 5e1e7ff1a..eee6dd762 100644 --- a/loader/shp2pgsql.c +++ b/loader/shp2pgsql.c @@ -12,6 +12,10 @@ * ********************************************************************** * $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 + } }