0

I'm using MapServer with PostgreSQL and I need to be able to limit the query using a UUID field. This column type is not mentioned in the documentation.

I can happily use other field types in the WHERE clause e.g.

DATA "geometry from (SELECT id_uuid, geometry, projectid, style_description from project.mytable where ukcode = 'a4c' and area_hectares < 0.0001) as subquery USING unique id_uuid USING srid=27700"

that works. But when I try and use a uuid column in the where clause like this...

DATA "geometry from (SELECT id_uuid, geometry, projectid from project.mytable where projectid = '61ff8678-8e45-496b-9aa8-f72b9a328175') as subquery USING unique id_uuid USING srid=27700"

I receive this error

msWFSGetFeature(): WFS server error. ms_error->code not found msPostGISLayerWhichShapes(): Query error. Error executing query. Check server logs

I can't get the error logs working which doesn't help.

I've also tried casting e.g. '61ff8678-8e45-496b-9aa8-f72b9a328175'::uuid but same result. I've also tried this in a Filter but its the same problem.

Have I got the correct syntax? Does anyone know - should I be able to query by uuid? Perhaps this isn't allowed but its not in the documentation

4
  • is your column formally set as uuid format ? Commented May 9 at 15:43
  • Did you copy your DATA sections right into your question? Especially the latter that has where projectid = '61ff8678-8e45-496b-9aa8-f72b9a328175') . Or is projectid just that uuid column? Is id_uuid also? Can you query that? Commented May 9 at 15:51
  • 1
    Have you tried where projectid::text = '61ff8678-8e45-496b-9aa8-f72b9a328175? Commented May 9 at 15:57
  • when I tried querying for id_uuid - this worked. This brings back 1 record. So I've worked out that when querying for the whole project via projectid - this means querying for thousands of records - and it timesout, producing that error. If I limit to say 10 records - it all works. I'll be adding an intersection to restrict the records so this should be fine. So my mistake - a where clause on a UUID field DOES work! Commented May 12 at 11:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.