Ticket #1822 (closed defect: fixed)

Opened 12 months ago

Last modified 3 months ago

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

  Changed 12 months ago by pramsey

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 ]

  Changed 12 months ago by pramsey

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

  Changed 12 months ago by strk

  • status changed from new to closed
  • resolution set to fixed

Fixed by r9748

  Changed 12 months ago by robe

  • status changed from closed to reopened
  • resolution fixed deleted

strk,

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

  Changed 12 months ago by strk

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 ?

  Changed 12 months ago by robe

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

  Changed 12 months ago by strk

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)

follow-up: ↓ 9   Changed 12 months ago by 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?

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   Changed 12 months ago by strk

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 ?

  Changed 12 months ago by robe

  • milestone changed from PostGIS 2.0.1 to PostGIS 2.0.2

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

  Changed 11 months ago by strk

  • status changed from reopened to closed
  • resolution set to fixed
  • milestone changed from PostGIS 2.0.2 to PostGIS 2.0.1

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

  Changed 3 months ago by gbell

  • cc gbell added
  • priority changed from blocker to high
  • status changed from closed to reopened
  • resolution fixed deleted

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

....

  Changed 3 months ago by gbell

  • priority changed from high to blocker

sorry, accidental priority change.

  Changed 3 months ago by gbell

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;

  Changed 3 months ago by gbell

  • status changed from reopened to closed
  • resolution set to fixed

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.