[postgis] Unable to drop contraint

John Reid jgreid at uow.edu.au
Sat Feb 23 07:47:33 PST 2002


Another alternative is to directly manipulate the postgres system 
catalogues (danger Will Robinson!!!!).  You will need at least usesuper 
rights (I tried only usecatupd with no joy - any idea what this actually 
gives you? I thought it would allow modification of the catalogues but 
obviously not).  In the end I just logged in as the postgres user.
  
itasca=> select * from pg_relcheck where rcrelid = (select oid from 
pg_class where relname = 'airports') and rcsrc = 'srid(the_geom) = -1)';
itasca=# delete from pg_relcheck where rcrelid = (select oid from 
pg_class where relname = 'airports') and rcsrc = 'srid(the_geom) = -1)';

You will also need to decrement the relchecks field in pg_class:
update pg_class set relchecks = 1 where relname = 'airports';

Otherwise the following error occurs:
itasca=> update airports set the_geom = SetSRID(the_geom,26915);
ERROR:  RelCheckFetch: 1 record not found for rel airports

Then, what do you know, it does work:
itasca=> update airports set the_geom = SetSRID(the_geom,26915);
UPDATE 12

Wonder what else I just broke....

cheers,
John

Paul Ramsey wrote:

>Create new table with same data def, but not constraint. 
>Select data from old into new.
>Delete old.
>Rename new to old.
>
>John Reid wrote:
>
>>*@#%$!  Postgresql doesn't allow the dropping of a contraint using ALTER
>>TABLE.  Anyone have an alternative idea?
>>
>>--
>>----------------------------------------------------------------------
>>john reid                                     e-mail jgreid at uow.edu.au
>>
>>uproot your questions from their ground and the dangling roots will be
>>seen.  more questions!
>>                                                       -mentat zensufi
>>
>>apply standard disclaimers as desired...
>>----------------------------------------------------------------------
>>
>>
>>
>>To unsubscribe from this group, send an email to:
>>postgis-unsubscribe at yahoogroups.com
>>
>>
>>
>>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>>
>


-- 
----------------------------------------------------------------------
john reid                                     e-mail jgreid at uow.edu.au
        
uproot your questions from their ground and the dangling roots will be
seen.  more questions!
                                                       -mentat zensufi

apply standard disclaimers as desired...
----------------------------------------------------------------------
 





------------------------ Yahoo! Groups Sponsor ---------------------~-->
Tiny Wireless Camera under $80!
Order Now! FREE VCR Commander!
Click Here - Only 1 Day Left!
http://us.click.yahoo.com/nuyOHD/7.PDAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 





More information about the postgis-users mailing list