Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#850 closed patch (fixed)

Binary IO support for geography type

Reported by: elprans Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: master
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 (2)

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

Download all attachments as: .zip

Change History (13)

by elprans, 14 years ago

Attachment: geography-binio-1.5.patch added

Patch for 1.5 branch

by elprans, 14 years ago

Attachment: geography-binio-trunk.patch added

Patch for trunk

comment:1 by strk, 13 years ago

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

comment:2 by strk, 13 years ago

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

comment:3 by strk, 13 years ago

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

comment:4 by strk, 13 years ago

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

comment:5 by strk, 13 years ago

Resolution: fixed
Status: newclosed

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.

comment:6 by strk, 13 years ago

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…

comment:7 by dustymugs, 13 years ago

strk,

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

comment:8 by strk, 13 years ago

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

comment:9 by strk, 13 years ago

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.

comment:10 by strk, 13 years ago

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

comment:11 by strk, 13 years ago

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

Note: See TracTickets for help on using tickets.