[postgis-devel] UnknownSRID value: 0 or -1 ?

Paul Ramsey pramsey at cleverelephant.ca
Mon Dec 12 18:42:47 PST 2011


I love you!

P.

On 2011-12-12, at 2:53 PM, Sandro Santilli <strk at keybit.net> wrote:

> On Mon, Dec 12, 2011 at 04:23:01PM +0100, Sandro Santilli wrote:
>> On Fri, Dec 09, 2011 at 10:03:52AM -0800, dustymugs wrote:
>>> On 12/09/2011 09:35 AM, Sandro Santilli wrote:
>>>> I've started work on testing dump/restore procedure for getting to 2.0
>>>> and realized the data w/out a proper SRID won't come back due to
>>>> ensure_srid_geom checks on tables insisting of the SRID being -1
>>>> rather than 0.
>>>> 
>>>> There's no much we can do to fix this, unless we're willing to
>>>> drop the constraints from the user dump.
>>>> 
>>>> For this reason I think it would be safer to get our unknown
>>>> srid back to -1 before it's too late (srid=0 getting in dumps
>>>> and making things even harder).
>>>> 
>>>> If somebody has smarter ideas I'm happy to listen to them.
>>>> 
>>> 
>>> I have no smarter ideas but I prefer 0 without any real reasons.  I
>>> don't get the purpose of having a SRID check constraint if the
>>> constraint is enforcing the unknown SRID.
>> 
>> Well, it's not something we have control on, it's stuff you have
>> in your database backup, unless you did something about it _before_
>> dropping it.
>> 
>> The only way I can think which could fix this would be changing ST_Srid
>> to return a SpatialRefSys object rather than an integer and make it
>> so an integer <= 0 casts to the _same_ SpatialRefSys object
>> (the "unknown srs" object). Mind you: SQL/MM does have such type...
> 
> I got to think of another way and implemented it.
> As of r8366 the utils/new_postgis_restore.pl will _rewrite_
> those constraints to ensure there's an st_ prefix and that
> checks for srid==-1  become checks for srid==0.
> It worked perfectly for me.
> 
> I also ported the logic about operators from the old version
> of that script and am now pretty happy about the core.
> 
> Raster and Topology may still need some love but the core seems fine.
> 
> --strk;
> 
>  ,------o-. 
>  |   __/  |    Thank you for PostGIS-2.0 Topology !
>  |  / 2.0 |    http://www.pledgebank.com/postgistopology
>  `-o------'
> 
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list