Ticket #90 (closed defect: fixed)
AddGeometryColumn inappropriately defaults to current_schema() if given nonexistent schema
| Reported by: | reid@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | PostGIS 1.3.6 |
| Component: | postgis | Version: | 1.3.X |
| Keywords: | Cc: |
Description
** What steps will reproduce the problem?
Execute the following SQL (assuming schema XXX does not exist):
create temp table foo ( ); select AddGeometryColumn?('XXX', 'foo', 'foopoint', 26915, 'POINT', 2);
** Actual behavior:
PostGIS sees that schema 'XXX' does not exist, then looks for table 'foo' in schema public, e.g. error message from above:
NOTICE: Invalid schema name - using current_schema() CONTEXT: SQL statement 'SELECT AddGeometryColumn?(, $1 , $2 , $3 , $4 , $5 , $6 )' PL/pgSQL function 'addgeometrycolumn' line 4 at SQL statement ERROR: relation 'public.foo' does not exist CONTEXT: SQL statement 'ALTER TABLE public.foo ADD COLUMN foopoint geometry ' PL/pgSQL function 'addgeometrycolumn' line 86 at execute statement SQL statement 'SELECT AddGeometryColumn?(, $1 , $2 , $3 , $4 , $5 , $6 )' PL/pgSQL function 'addgeometrycolumn' line 4 at SQL statement
As an aside, this error message is verbose and confusing; I initially missed the first line and was rather baffled that PostGIS insisted on trying 'public' when I had clearly asked for 'XXX'.
** Expected behavior:
PostGIS looks for table in given schema, fails, and gives up with an error, e.g. desired error message for above:
ERROR: schema 'XXX' does not exist
** What version of the product are you using? On what operating system?
Ubuntu Hardy PostgreSQL 8.2.7 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu4) POSTGIS='1.3.3' GEOS='3.0.0-CAPI-1.4.1' PROJ='Rel. 4.6.0, 21 Dec 2007' USE_STATS

