Opened 13 years ago

Closed 12 years ago

#1822 closed defect (fixed)

topology won't install on PostgreSQL 9.2beta1

Reported by: robe Owned by: strk
Priority: blocker Milestone: PostGIS 2.0.1
Component: topology Version: 2.0.x
Keywords: Cc: gbell

Description

Breaks on this line:

ALTER DOMAIN topology.TopoElement DROP CONSTRAINT type_range;

with error: constraint "type_range" of domain "topology.topoelement" does not exist

I'm surprised this works on older versions it seems older versions of PostgreSQL simply ignore this line if the constraint doesn't exist so I can run that an infinite number of times on older without warning. So i suspect this is a bug fix in 9.2.

Change History (15)

comment:1 by pramsey, 13 years ago

They've simultaneously added an "IF EXISTS" option to ALTER DOMAIN while tightening up the behaviour

ALTER DOMAIN name
    DROP CONSTRAINT [ IF EXISTS ] constraint_name [ RESTRICT | CASCADE ]

comment:2 by pramsey, 13 years ago

Er, in 9.2 that is. So 9.1 doesn't have "IF EXISTS" but it also isn't strict.

comment:3 by strk, 13 years ago

Resolution: fixed
Status: newclosed

Fixed by r9748

comment:4 by robe, 12 years ago

Resolution: fixed
Status: closedreopened

strk,

I'm having the same issue on 2.1 for 9.2. Did you not forward port?

comment:5 by strk, 12 years ago

I d see the IF EXISTS block in svn-trunk, r9748 was before the branch. Maybe your postgis_config.h is still thinking pgsql is 9.1 ?

comment:6 by robe, 12 years ago

Well my postgis_config.h reads:

#define POSTGIS_PGSQL_VERSION 921

but 921 is still greater than 91 so it should be picking up the setting, but the generated topology.sql doesn't have IF EXISTS in it.

Perhaps the topology.sql.in.c is not picking up the POSTGIS_PGSQL_VERSION. Doesn't it need an include like postgis.sql.in.c has.

#include "sqldefines.h"

It's quite possible I didn't test this after you made the change in 2.0.1. I do see that the fix is in place though just not working.

The generated topology/Makefile shows

POSTGIS_PGSQL_VERSION=921

comment:7 by strk, 12 years ago

topology.sql.in.c does include sqldefines.h your POSTGIS_PGSQL_VERSION is really bad, btw (might not break this case but a others it could)

comment:8 by robe, 12 years ago

I only see it at the end and I think I even added it http://trac.osgeo.org/postgis/browser/trunk/topology/topology.sql.in.c?rev=9748#L1987 (and I think I added that because I needed it for the SQLManagement to know whether I can DO or not DO. We won't be needing that check anymore for 2.1.0 once you upgrade from your crappy 8.4 and 9.0 is the minor. Then I can be DOing all I want :).

does the fact that your check happens before the variable is defined matter?

Well the POSTGIS_PGSQL_VERSION I presume is something screwy with our parsing.

The version is 9.2beta1 Seems like its picking up the 1 part as part of version number.

in reply to:  8 comment:9 by strk, 12 years ago

Replying to robe:

I only see it at the end and I think I even added it http://trac.osgeo.org/postgis/browser/trunk/topology/topology.sql.in.c?rev=9748#L1987 (and I think I added that because I needed it for the SQLManagement to know whether I can DO or not DO. We won't be needing that check anymore for 2.1.0 once you upgrade from your crappy 8.4 and 9.0 is the minor. Then I can be DOing all I want :).

does the fact that your check happens before the variable is defined matter?

Yes, it does! Please move it on top and see if it works for you. I probably didn't check as I don't have 9.2 built.

Well the POSTGIS_PGSQL_VERSION I presume is something screwy with our parsing.

The version is 9.2beta1 Seems like its picking up the 1 part as part of version number.

Could you file a separate bug for this ?

comment:10 by robe, 12 years ago

Milestone: PostGIS 2.0.1PostGIS 2.0.2

I'll push this and push back if I get to it before release.

comment:11 by strk, 12 years ago

Milestone: PostGIS 2.0.2PostGIS 2.0.1
Resolution: fixed
Status: reopenedclosed

Still untested by myself, but I belive this time it should be fixed. r9903 in branch, r9904 in trunk.

comment:12 by gbell, 12 years ago

Cc: gbell added
Priority: blockerhigh
Resolution: fixed
Status: closedreopened

Hello,

I think this bug exists in 2.0.2.

I have a fresh install of Fedora 18 here, with a fresh postgresql 9.2.3-1.fc18. I've just built postgis 2.0.2 and am installing it into my DB.

When I run topology, this error shows up.

psql -d template_postgis2 -f /usr/share/pgsql/contrib/postgis-2.0/topology.sql

….

ALTER DOMAIN psql:/usr/share/pgsql/contrib/postgis-2.0/topology.sql:382: NOTICE: constraint "type_range" of domain "topology.topoelement" does not exist, skipping ALTER DOMAIN

…..

CREATE FUNCTION psql:/usr/share/pgsql/contrib/postgis-2.0/topology.sql:4106: NOTICE: aggregate topology.topoelementarray_agg(topology.topoelement) does not exist, skipping DROP AGGREGATE

….

comment:13 by gbell, 12 years ago

Priority: highblocker

sorry, accidental priority change.

comment:14 by gbell, 12 years ago

I checked the code I compiled from - here it is:

#include "../postgis/sqldefines.h"

CREATE SCHEMA topology;

— Doing everything outside of a transaction helps — upgrading in the best case. BEGIN;

comment:15 by gbell, 12 years ago

Resolution: fixed
Status: reopenedclosed

Aha. That message is now only generated as a notice, not an error, and can be ignored. Notices are automatically generated by the 'IF EXISTS' clause if the item doesn't exist.

So if you arrive at this thread via Google, wondering about these weird missing constraints during your install of topology, rest easy - they are only notices. Looks concerning, isn't important.

Apols to maintainer for any time taken on this.

Note: See TracTickets for help on using tickets.