[postgis-users] postgis support for 7.4 betas

David Blasby dblasby at refractions.net
Mon Sep 29 10:46:18 PDT 2003

Paul Ramsey wrote:
> Tell me again why we use the wkb type instead of piggybacking on bytea?

If you want to piggyback on bytea, then you're more than welcome to give 
your queries like:

SELECT asBinary(the_Geom)::bytea ....
SELECT bytea(asBinary(the_Geom)) ....

You'll notice that the bytea representation is *much* longer than the 
wkb representation.

cwb_wsa50_test=# select asbinary('POINT(0 0)');
(1 row)

cwb_wsa50_test=# select asbinary('POINT(0 0)')::bytea;

(1 row)

Also, external applications will be able to tell that what they're 
getting is WKB instead of just some arbitrary bytea.

For example, an application (say a JDBC client) will be able to tell the 
difference between these two queries:

SELECT asbinary(the_Geom) FROM geoTable;
SELECT '\001\001\000'::bytea FROM geoTable;


More information about the postgis-users mailing list