Opened 8 years ago

Last modified 8 years ago

#3495 closed defect

AddGeometryColumn relies on table being in search_path — at Initial Version

Reported by: robe Owned by: pramsey
Priority: blocker Milestone: PostGIS 2.2.2
Component: postgis Version: 2.2.x
Keywords: Cc:

Description

Okay discovered an isssue with my search_path setting logic. The way our AddGeometryColumn works. The version that doesn't take schema requires the table with geometry column being added has schema set.

I discovered this issue with

CREATE SCHEMA postgis VERSION "2.3.0dev";
CREATE EXTENSION postgis SCHEMA postgis;
ALTER DATABASE workshop_1
  SET search_path = public, postgis;

-- and then using shp2pgsql to restore
shp2pgsql -I -D -s 26986 data/MBTA_ARC mbta_lines | psql

ALTER TABLE
ERROR:  Table 'mbta_lines' does not occur in the search_path
CONTEXT:  SQL statement "SELECT AddGeometryColumn('',$1,$2,$3,$4,$5,$6,$7)"
PL/pgSQL function addgeometrycolumn(character varying,character varying,character varying,integer,character varying,integer,boolean) line 5 at SQL statement
ERROR:  current transaction is aborted, commands ignored until end of transaction block
invalid command \.
ERROR:  syntax error at or near "GREEN"
LINE 1: GREEN C D 7 4.58386095740e+002 01050000206A69000001000000010...
        ^
ROLLBACK
ERROR:  relation "mbta_lines" does not exist

So I guess we've got to exclude all these from my search_path logic I put in on #3490. Eventually I think we'll need to force everyone to install postgis in same schema and schema qualify at least these ones and relationship ones that rely on users schema to be in search path to work well.

Change History (0)

Note: See TracTickets for help on using tickets.