[postgis-devel] Valid SRIDs

Kevin Neufeld kneufeld at refractions.net
Thu Jun 26 08:22:59 PDT 2008


Tom Lane wrote:
> Stephen Frost <sfrost at snowman.net> writes:
>> Things, in my view anyway, get a fair bit more complicated when you
>> consider the changes we've been talking about to use PG's user-defined
>> typmods.  It feels like it'd be 'awkward' to enforce that check in the
>> typmod and would also mean, I believe, more difficulty when dealing with
>> dump/restores unless things are done in the right order.
> 
> Whichever way it's done, you need to worry about whether pg_dump will
> understand it and dump the tables in the right order.  It would be very
> easy to have a situation where spatial_ref_sys doesn't get populated
> until after user tables containing geometry values.  I think only a
> foreign key constraint would currently be guaranteed to work properly.
> 
> 			regards, tom lane

Agreed.  Just thinking out loud here ... What if PostgreSQL offered the 
ability to put foreign keys on functional references ... kind of like 
functional indexes?

ALTER TABLE foo
   ADD CONSTRAINT foo_func_fkey
   FOREIGN KEY (ST_Srid(the_geom))
   REFERENCES public.spatial_ref_sys (srid);

I think this would pd_dump in the correct order.  But again we have the 
problem of the spatial_ref_sys turning into a view down the road.

-- Kevin



More information about the postgis-devel mailing list