Opened 12 years ago

Closed 12 years ago

#1499 closed defect (fixed)

topology regression tests fail creating already-present schema

Reported by: gdt Owned by: strk
Priority: medium Milestone: PostGIS 2.0.0
Component: topology Version: master
Keywords: Cc:

Description

With r8916, pgsql 9.1.2 on NetBSD/i386 5ish, the topology tests pass on the first pass, and then fail to upgrade:

Upgrading topology

 Something went wrong during db initialization (topology upgrade).
 For details, check /tmp/pgis_reg_1268/regress_log

gmake[1]: *** [check] Error 1

In the log:

psql:/home/gdt/SOFTWARE/POSTGIS/postgis/regress/00-regress-install/share/contrib/postgis/topology_upgrade_20_minor.sql:212: ERROR:  schema "topology" already exists

I tried commenting out the drop schema statement, but that caused it to happen during installation, which also failed. So it seems upgrade needs to cope with the schema already being present.

Change History (5)

comment:1 by gdt, 12 years ago

To the best of my knowledge I have an empty .pgsqlrc and no pgsql environment variables.

comment:2 by Bborie Park, 12 years ago

The problem does have to do with sed and possibly bash. Testing just the sed command of topology_upgrade.sql in topology/Makefile on an old FreeBSD machine (6.1) using the csh shell, the command fails miserably.

comment:3 by gdt, 12 years ago

The issue is the same as ticket:1533.

Index: topology/Makefile.in
===================================================================
--- topology/Makefile.in	(revision 9013)
+++ topology/Makefile.in	(working copy)
@@ -76,8 +76,8 @@
 #Generate upgrade script by stripping things that can't be reinstalled
 #e.g. don't bother with tables, types, triggers, and domains
 topology_upgrade.sql:  topology.sql
-	 sed -e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\).*;/d' \
-	 	 -e '/^\(CREATE\|ALTER\) \(CAST\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\)/,/\;/d' \
+	 sed -E -e '/^(CREATE|ALTER) (CAST|TYPE|TABLE|SCHEMA|DOMAIN|TRIGGER).*;/d' \
+	 	 -e '/^(CREATE|ALTER) (CAST|TYPE|TABLE|SCHEMA|DOMAIN|TRIGGER)/,/;/d' \
 	 	 $< > $@
 	 	 
 topology_upgrade_20_minor.sql:  topology_drop_before.sql topology_upgrade.sql topology_drop_after.sql

comment:4 by gdt, 12 years ago

@dustymugs: My personal shell is bash, but given ticket:1527, I believe that make uses /bin/sh to run commands, not the user's shell. I am curious how it works on FreeBSD with my patch.

comment:5 by gdt, 12 years ago

Resolution: fixed
Status: newclosed

At r9063, topology_upgrade.sql seems to be correctly missing the CREATE statements. They are replaced by blank lines; I'm not sure if that's the plan or not, but it doesn't seem problematic.

Note: See TracTickets for help on using tickets.