Opened 19 years ago

Closed 15 years ago

#1284 closed defect (fixed)

Queries fail when using certain unique keys

Reported by: cplists+bugs@… Owned by: refractions
Priority: high Milestone:
Component: PostGIS Interface Version: 4.4
Severity: normal Keywords:
Cc: mapserver@…

Description

This is a strange bug that someone can hopefully resolve.  I had a situation
where QUERYing on certain layers were failing but other layers that were defined
using the exact same DATA line were working fine. (The only difference between
the different layer definitions was their FILTER and CLASS definitions.)

Here's an example of the layer definition that wasn't working:

 LAYER
  CONNECTIONTYPE postgis
  NAME "Name"
  CONNECTION "user=gis password=gis dbname=db host=host"
  DATA "geometry from gis_table USING SRID=4267 USING UNIQUE myuniq_id"
#  DATA "geometry from gis_table USING SRID=4267 USING UNIQUE oid"
  PROJECTION "+init=epsg:4267" END
  TEMPLATE "void.html" # needed to make the layer queryable...
  TOLERANCE 5
  TOLERANCEUNITS PIXELS
  STATUS OFF
  TYPE LINE
  FILTER "company_id = '1234'"
  LabelItem "name"
  CLASS
   COLOR 255 0 0
   MAXSCALE 1500000
   LABEL
    ANGLE AUTO 
    COLOR  255 0 0
    FONT fritqat
    TYPE truetype
    SIZE 8
    POSITION AUTO
    PARTIALS FALSE
    FORCE TRUE
    OUTLINECOLOR 255 255 255      
   END 
  END
 END

Thanks to the help of someone else who had run into a similar problem I tried
switching to using the built-in oid column and things started working. 

Now the bizarre thing is that I have other layers that were working fine using
my own myuniq_id column and the same table.  The only difference that I can see
between the layers that worked and the ones that did not is that for the ones
that worked the unique id happened to be 10 characters long while for the ones
that did not work the unique id happened to be 12 characters long!?!

Are there some arbitrary constraints on the column specified in the USING UNIQUE
clause?  Some other bug?  In my case the myuniq_id column is defined as varchar(20).

Hope this helps.

Corey

Change History (2)

comment:1 by mapserver@…, 19 years ago

Cc: mapserver@… added

comment:2 by pramsey, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in 5.4 at r 9047. Fixed in trunk at r9048.

Note: See TracTickets for help on using tickets.