Postgres OIDs and box2d, box2df, box3d, and gidx: differences and usage?

Tom Payne twpayne at gmail.com
Fri Jun 7 12:20:46 PDT 2024


Thank you very much Paul for the fast and complete reply!

Thanks also for the pointer to postgis.sql.in
<https://git.osgeo.org/gitea/postgis/postgis/src/branch/master/postgis/postgis.sql.in>
-
I'd missed that and it's really helpful to understand PostGIS's internals.

I'm aware that the OIDs are dynamic, but thanks for the reminder! I look
them up after establishing the DB connection:

https://github.com/twpayne/pgx-geos/blob/6f61360a93a5751a59511540bc2119cbae033ca0/geom.go#L184

Are there any plans to add binary representations of box2d and box3d? The
background story is that https://pkg.go.dev/github.com/jackc/pgx/v5 uses
Postgres's binary protocol when possible for performance, so I suspect/fear
that if a query includes a box2d or box3d then jackc/pgx will have to
switch to the lower-performance text-based protocol. In practice, this is
unlikely to be a real problem, but I'm curious :)

Thanks again, and best regards,
Tom



On Fri, 7 Jun 2024 at 20:36, Paul Ramsey <pramsey at cleverelephant.ca> wrote:

> On Fri, Jun 7, 2024 at 1:49 AM Tom Payne <twpayne at gmail.com> wrote:
>
> > obstacledb=# SELECT typname, oid FROM pg_type WHERE typname IN ('box2d',
> 'box2df', 'box3d', 'gidx');
> >  typname |   oid
> > ---------+---------
> >  box3d   | 5248539
> >  box2d   | 5248543
> >  box2df  | 5248547
> >  gidx    | 5248551
> > (4 rows)
>
> Oh, and you probably already know this, but just for completeness: the
> Oid numbers of the PostGIS types will VARY between databases, because
> they are assigned at run-time by the PostgreSQL server. So the Oid you
> have for geometry will not be the same as the one I have.
>
> ATB,
> P
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20240607/361628e9/attachment.htm>


More information about the postgis-devel mailing list