[postgis-users] Difference between "Geometry" and "BLOB" in Postgis

Sandro Santilli strk at keybit.net
Fri Oct 31 13:32:33 PDT 2014


On Fri, Oct 31, 2014 at 01:49:59PM -0400, Robert Burgholzer wrote:
> Working at the module level in Drupal, creating queries with spatial
> operators for Views.  Basically, Drupal's GeoField module stores geoms as
> "bytea", which the PostGIS functions seem to handle quite nicely without a
> cast. 

The cast is there, only it's implicit.
When you call a function, PostgreSQL looks for candidates.
Example: you call ST_Length(bytea), PostgreSQL finds an
ST_Length(geometry) and see if a cast from geometry to bytea exists
and is tagged as allowed to be implicit, it finds it and calls it.

You can see this yourself by creating your own ST_Length(bytea) function,
in which case it'll be called instead of ST_Length(geometry).

In case multiple candidates exist with the same number of implicit casts
required, PostgreSQL will raise an error.

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the postgis-users mailing list