Opened 9 years ago

Closed 9 years ago

#3434 closed defect (invalid)

Creating topogeom errors when topogeom name includes CAPITAL LETTERS

Reported by: LucasBr Owned by: strk
Priority: medium Milestone: PostGIS 2.2.2
Component: topology Version: 2.2.x
Keywords: Cc:

Description

I was getting an error when trying to create a topogeom with a name that included capital letters. Shouldn't Postgresql be case insensitive? The error occurs in the "toTopoGeom" function.

See reproducible example bellow


-- Testing case sensitivity

SELECT topology.DropTopology('test1');
SELECT topology.CreateTopology('test1',32719);
SELECT topology.addtopogeometrycolumn('test1', 'public','temp_geom_ac','tg_a','POLYGON');
UPDATE temp_geom_ac SET tg_a = toTopoGeom(geom_dump_utm,'test1', 1, 1) ;

-- ERROR:  Spatial exception - geometry intersects edge 541
-- CONTEXT:  PL/pgSQL function totopogeom(geometry,topogeometry,double precision) line 111 at FOR over SELECT rows
-- PL/pgSQL function totopogeom(geometry,character varying,integer,double precision) line 94 at assignment

-- Above, with tg_a in lower letters,  it "works" (I mean the erros is  because of problems in the polygons, not calling the topogeom name)

SELECT topology.DropTopology('test2');
SELECT topology.CreateTopology('test2',32719);
SELECT topology.addtopogeometrycolumn('test2', 'public','temp_geom_ac','tg_B','POLYGON');
UPDATE temp_geom_ac SET tg_B = toTopoGeom(geom_dump_utm,'test2', 1, 1) ;

-- ERROR:  column "tg_b" of relation "temp_geom_ac" does not exist
-- LINE 1: UPDATE temp_geom_ac SET tg_B = toTopoGeom(geom_dump_utm,'tes...

Change History (1)

comment:1 by strk, 9 years ago

Resolution: invalid
Status: newclosed

PostgreSQL lowercases identifiers when you don't quote them. The AddTopoGeometryColumn function always retains full casing of the identifiers you pass as string parameters, so the field would be called "tg_B". If you quote it in the UPDATE statement it should work.

Note: See TracTickets for help on using tickets.