Ticket #850 (closed patch: fixed)

Opened 2 years ago

Last modified 16 months ago

Binary IO support for geography type

Reported by: elprans Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: trunk
Keywords: Cc:

Description

Per  mailing list post:

I'm currently working on adding support for postgis to py-postgresql and stumbled upon a fact that geography type does not support binary IO, i.e. send/receive functions are unimplemented. I attached rough patches to add said functions to IO geography through WKB. I'm also wondering if there is a deeper reason for the send/receive omission -- implementation is trivial enough.

Attachments

geography-binio-1.5.patch Download (5.9 KB) - added by elprans 2 years ago.
Patch for 1.5 branch
geography-binio-trunk.patch Download (6.1 KB) - added by elprans 2 years ago.
Patch for trunk

Change History

Changed 2 years ago by elprans

Patch for 1.5 branch

Changed 2 years ago by elprans

Patch for trunk

Changed 16 months ago by strk

Alarm! Alarm! This patch would require dump/reload.

I'm all for fixing this (for trunk, not 1.5), but please someone from the PSC add its +1 here

Changed 16 months ago by strk

@elprans, anyone : can you imagine a way to test binary IO ? psql doesn't let you IIRC

Changed 16 months ago by strk

a-ha! found a way:

strk=# declare x binary cursor for select g from zmgeog;
DECLARE CURSOR
strk=# fetch 1 from x;
ERROR:  no binary output function available for type geography

Changed 16 months ago by strk

r8859 adds regression test for canonical binary output of the GEOMETRY type. Now adding GEOGRAPHY.

Changed 16 months ago by strk

  • status changed from new to closed
  • resolution set to fixed

r8860 applies a modified version of the patch (didn't apply cleanly otherwise).

NOTE: I realized that the canonical binary input function may need to deal with typmod. I saw this done in the patch and kept it but it is NOT done for geometry.

Neither binary inputs are tested so I think there are high chances of them being broken :>

Implementation of testing for canonical binary input is welcome. Can't be done by regress/run_test for obvious reasons.

Changed 16 months ago by strk

Mind you: this is another change requiring dump/reload, and we might better off also stubbing the selectivity estimators for geography as soon as possible as those one would require another dump/reload...

Changed 16 months ago by dustymugs

strk,

Is this dump/reload required if you are not using the geography type?

Changed 16 months ago by strk

No, and not even if you are using it but not needing the binary IO feature ...

Changed 16 months ago by strk

r8861 adds testing for canonical input as well using a binary cursor based round-trip. They weren't broken ! :)

Note that it _could_ be done with regress/run_test, using COPY TO/COPY FROM.

typmod on binary input is still untested.

Changed 16 months ago by strk

I confirm binary input of geography lets you write mismatching typmods !!! Working on a sane regression test

Changed 16 months ago by strk

With r8867 we have full coverage of binary IO including typmod handling.

Note: See TracTickets for help on using tickets.