[postgis-devel] gserialized-v2
Sandro Santilli
strk at kbt.io
Tue Jun 25 02:14:45 PDT 2019
On Sat, Jun 22, 2019 at 08:37:48AM -0700, Paul Ramsey wrote:
> On Sat, Jun 22, 2019 at 1:05 AM Sandro Santilli <strk at kbt.io> wrote:
> >
> > Where's the serialized version info, btw ?
>
> In the end of the gflags. Check the contents of gserialized.h and gserialized2.h
I gave a quick look and found this in gserialized2.h:
#define G2FLAG_Z 0x01
#define G2FLAG_M 0x02
#define G2FLAG_BBOX 0x04
#define G2FLAG_GEODETIC 0x08
#define G2FLAG_EXTENDED 0x10
#define G2FLAG_UNUSED 0x20
#define G2FLAG_VER_0 0x40
#define G2FLAG_VER_1 0x80
In the gserialized2.c file I see a call to:
G2FLAGS_SET_VERSION(gflags, 1);
But no corresponding SET_VERSION call in gserialized.c
The gserialized.txt says:
typedef struct
{
uint32 size; /* For PgSQL use, use VAR* macros to manipulate. */
uchar srid[3]; /* 21 bits of SRID (and 3 spare bits) */
uchar flags; /* Version, Validity, Solid, ReadOnly, IsGeodetic, HasZ, HasM, HasBBox */
uchar data[1]; /* See gserialized.txt */
} GSERIALIZED;
The G2FLAG_* macros in gserialized2.h seem to cover the whole
bit space of the "flags" component of that struct, but the comments
don't seem ot match, like there's no "validity", no "solid",
no "readonly" so I'm a bit confused about what that .txt file
documents....
I understand this is being done a bit in rush, but I think we would
benefit from a clear document about the new format. When we moved
from HWGEOM to LWGEOM there was a formal document I think, and lots
of back and forth in analysing that. I would just like to avoid
being stuck with some format that'll be hard to move forward.
I love the "G2FLAG_UNUSED", for this matter (maybe it could be renamed
"G2FLAG_RESERVED" to clarify that we plan to use it in the future but
current code should ensure that bit is always clear now).
I'm not sure I understand the use of 2 bits for the version, since we
currently only have 2 versions (so a single bit should do).
--strk;
More information about the postgis-devel
mailing list