Opened 20 months ago

Closed 20 months ago

Last modified 20 months 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 Changed 20 months ago by strk

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

comment:2 Changed 20 months ago by strk

See also #3633

comment:3 Changed 20 months ago by strk

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

Resolution: fixed
Status: newclosed

In 17297:

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

Fixes #4339

comment:5 Changed 20 months ago by strk

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.