2

Sometimes I find PostGIS sql examples like that, with a dot indicating a property name of a field, I suppose.

select st_dump(geom).geom from table

However, when I run this in my computer, I get:

Kernel error: ERROR: syntax error at or near "."

I´m using postgre 9.6.

What´s going on?

6

The function, here st_dump, returns a composite type (similar to a table). You can either get an aggregate of all returned fields or get one or more in their own column. To do so, you need to add an extra parenthesis around the function to make it clear you are not referencing a table but the function result. You can read the doc Accessing composite types

select (st_dump(geom)).geom from table;

or to get all fields

select (st_dump(geom)).* from table;
  • 2
    @MauroAssis :-) great! Please consider accepting the answer (green check mark to the left) so others know it is a working solution – JGH Apr 27 '18 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.