Home > Enterprise >  Postgis wire data types
Postgis wire data types

Time:12-12

I am implementing a java client for postgres and added postgis support.
I am trying to figure out the wire protocol types that are returned for geometric data types.

It looks like different postgis versions has different type number returned. In some version it was 18011 and another has 17995 for line string. You can see related test I did here:

// previous
PostgreSQLColumnDecoderRegistry.Instance.registerDecoder(18011, JtsColumnDecoder())
// current
PostgreSQLColumnDecoderRegistry.Instance.registerDecoder(17995, JtsColumnDecoder())

IIUC the types can be seen on the db itself here on pg_type table: https://www.postgresql.org/docs/current/catalog-pg-type.html

Do you know where I can find docs / code about the type numbering rules?

CodePudding user response:

The object IDs of the PostGIS data types are dynamically allocated when you create the extension. Consequently, they will normally be different in different PostgreSQL databases. One of the simplest queries to find the object ID of geometry is

SELECT 'geometry'::regtype::oid;
  • Related