Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#4339 closed defect (fixed)

CREATE EXTENSION postgis FROM unpackaged: ERROR: operator does not exist: geometry ~~ geometry

Reported by: strk Owned by: pramsey
Priority: blocker Milestone: PostGIS 3.0.0
Component: postgis Version: master
Keywords: Cc:

Description

This happens right after unpackaging postgis code from current trunk (using opt_out.sh):

strk=# select postgis_extensions_upgrade();
ERROR:  operator does not exist: geometry ~~ geometry
CONTEXT:  SQL statement "ALTER EXTENSION postgis ADD OPERATOR ~~  (geometry,geometry)"
PL/pgSQL function inline_code_block line 3 at SQL statement
SQL statement "CREATE EXTENSION postgis FROM unpackaged"
PL/pgSQL function postgis_extensions_upgrade() line 48 at EXECUTE

Change History (5)

comment:1 by strk, 6 years ago

We should add unpackage/repackage tests in our testsuite. Maybe with a --repackage switch to run_test.pl ?

comment:2 by strk, 6 years ago

See also #3633

comment:3 by strk, 6 years ago

I think the problem arises from the unpackaged--3.0.0.sql script doing so:

$postgis_proc_upgrade$
BEGIN
  IF 300 > version_from_num FROM _postgis_upgrade_info THEN
    EXECUTE $postgis_proc_upgrade_parsed_def$ CREATE OPERATOR ~~ (
...

As I'm _already_ coming form 3.0.0 (-dev) that operator is NEVER crated. I guess we could tweak the block so that operators are _only_ added if missing (in addition to trusting the version). What do you think about this Regina ?

comment:4 by strk, 6 years ago

Resolution: fixed
Status: newclosed

In 17297:

Upon upgrade, create operators when missing (no matter version)

Fixes #4339

comment:5 by strk, 6 years ago

For the record: I changed the code to _only_ rely on absence of operators when adding them (basically NOT using the version at all) -- could be improved in the future to raise an error (or warning) if the operator already exists when not expected to

Note: See TracTickets for help on using tickets.