[postgis-devel] Typmod Again
Stephen Frost
sfrost at snowman.net
Wed Jul 22 17:18:04 PDT 2009
* Paul Ramsey (pramsey at cleverelephant.ca) wrote:
> 32 bits:
> Top 24 bits for SRID,
> Middle 6 bits for Type,
> Bottom 2 bits for Z/M flags.
Don't we only get 31 bits, since returning a negative value for typmod
is an indication of failure?
> The difficulty is not doing typmod, it's doing it without breaking
> backwards compatibility. I'm also currently running into some oddness
> with PgSQL not handing me the typmod in the _in function (which is
> required to enforce the restriction), even though one is defined on
> the column.
Could it be due to above, where you've mistakenly ended up returning a
negative value..? Just a thought.
> There's some issues in general with typmod, I fear, which is that a
> typmod is not a constraint. Where is it enforced? It seems like only
> in the _in function, which just protects the on inserts from text.
That's a good point. Have you looked at how it's done for NUMERIC?
> If I do
>
> UPDATE mytable SET thegeom = ST_SetSRID(thegeom, 1111)
>
> and 1111 is not my SRID typmod, what happens?
I would hope that there's an opportunity somewhere in the user defined
type code to handle this.. Does it go through the binary recv/send
functions? If so, couldn't this check be handled there?
Thanks,
Stephen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20090722/0c75a4e6/attachment.sig>
More information about the postgis-devel
mailing list