You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following function will return a geometry interface as a return type instead of a point geometry. This is particularly frustrating for computed columns on tables (for example generating a centroid for a polygon geometry).
CREATEFUNCTIONmyschema.mytable_pos(mytable myschema.mytable) RETURNS geometry(Point,4326) AS $$
SELECT st_pointonsurface(geom)
$$ LANGUAGE sql STABLE
The text was updated successfully, but these errors were encountered:
Annoyingly this is a limitation of PostgreSQL. It may look like it returns that type in your definition but if you look in a pg_dump of the database you’ll notice the modifier is dropped. PostgreSQL does not store this.
@benjie ah, ok so postgres is not even storing the return type modifiers -that is bizarre behavior on the part of postgres as type modifiers are pretty important!
Maybe for these types of cases an @forceType tag would be beneficial so that the modifiers could be manually specified.
Yeah, implementing it would be tricky since the modifier is a 4 byte binary value under the hood. Effectively you’d have to encode the human readable version back to the byte representation so that PostGraphile could convert it back again; and it would only be useful for postgis since every type processes it’s modifiers differently. If you’re interested in taking this on; here’s a starting point:
With
The following function will return a geometry interface as a return type instead of a point geometry. This is particularly frustrating for computed columns on tables (for example generating a centroid for a polygon geometry).
The text was updated successfully, but these errors were encountered: