#3124 closed defect (fixed)
single quote problem in postgresql validation query (PostGIS layer)
Reported by: | christiangda | Owned by: | pramsey |
---|---|---|---|
Priority: | normal | Milestone: | 5.4.2 release |
Component: | PostGIS Interface | Version: | 5.4 |
Severity: | normal | Keywords: | |
Cc: | pramsey, sdlime |
Description
When you use a PostGIS layer passing to it the geometry (see attachment map), the layer is drawed, but PostgreSQL log show this error:
VET-idleERROR: syntax error at or near "0105000020E610000007000000010200000002000000030000" at character 269 VET-idleSTATEMENT: select attname from pg_attribute, pg_constraint, pg_class where pg_constraint.conrelid = pg_class.oid and pg_class.oid = pg_attribute.attrelid and pg_constraint.contype = 'p' and pg_constraint.conkey[1] = pg_attribute.attnum and pg_class.relname = '(SELECT 1 as oid, '0105000020E610000007000000010200000002000000030000BFEDBA50C0190000782F072540C3A056D0EDBA50C0FDADEBCF2C072540010200000002000000C3A056D0EDBA50C0FDADEBCF2C07254061601029F2BA50C01C1D82E73307254001020000000200000061601029F2BA50C01C1D82E733072540EB17E849F6BA50C0A13009A33A072540010200000002000000EB17E849F6BA50C0A13009A33A07254083EA883EF4BA50C0046956478407254001020000000200000083EA883EF4BA50C00469564784072540396D4E91F3BA50C0806332219D072540010200000002000000396D4E91F3BA50C0806332219D072540396D4E91F3BA50C0826332219D072540010200000002000000396D4E91F3BA50C0806332219D072540020080FCF3BA50C0EEFFFFDB9D072540'::geometry AS the_geom) AS FOO' and pg_table_is_visible(pg_class.oid) and pg_constraint.conkey[2] is null
The problem are the two single quote in the argument "pg_class.relname =" see:
'(SELECT 1 as oid, '0,
if you can chage it to '(SELECT 1 as oid, 0 in runtime when you detect single quote within the string, maybe the proble was fixed.
1 Download the attachment map 2 shp2img -m sample.map -o sample.jpg 3 tail -30 your_postgresql_log_file.log
Attachments (2)
Change History (7)
by , 15 years ago
Attachment: | sample.map added |
---|
comment:1 by , 15 years ago
Component: | MapServer C Library → PostGIS Interface |
---|---|
Owner: | changed from | to
comment:2 by , 15 years ago
Cc: | added |
---|
by , 15 years ago
Attachment: | pg_subselect.patch added |
---|
follow-up: 4 comment:3 by , 15 years ago
Owner: | changed from | to
---|
Since the data source is not a table, the primary key cannot be looked up. As an interim measure, here is a patch which provides a reasonable error message. You can work around the problem by specifying a 'using unique' item in your data line, which will skip the primary key lookup and this error. In the longer term, with the one-pass query, the need for a primary key diminishes sharply, and the code should be examined to push the testing requirement into just those code paths which need it.
comment:4 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to pramsey:
Since the data source is not a table, the primary key cannot be looked up. As an interim measure, here is a patch which provides a reasonable error message. You can work around the problem by specifying a 'using unique' item in your data line, which will skip the primary key lookup and this error. In the longer term, with the one-pass query, the need for a primary key diminishes sharply, and the code should be examined to push the testing requirement into just those code paths which need it.
Thanks a lot, This solved my problem!.
Map file