<div dir="ltr"><div><div><div>OK,<br><br></div>Looks like I will have a go at this.<br><br></div></div>I'm thinking of the following:<br><ol><li>Check all referenced postgis objects (ie: in table creation, index creation) for schema qualification<br>
</li><li>If <b>--migrate-schema</b> is specified (no argument) then remove the schema <br></li><li>If <b>--migrate-schema schema</b> is specified then replace the schema qualification with <b>schema</b></li></ol><p>This way you can either remove schema qualification (manage with search_path OR enforce correct schema qualification.</p>
<p></p><p>Does anyone have any thoughts on locating PostGIS objects? I can use the inline list but functions could prove difficult - for example determining the difference between <b>function(int) </b>and a user defined <b>function(real)</b>?</p>
<p></p><p>How comfortable would people be with assuming users are not creating non-postgis functions with clashing names?</p><p></p><p>Cheers,<br></p></div><div class="gmail_extra"><br clear="all"><div><div style="color:#b8276a;font:bold 14px Arial,Helvetica,sans-serif">

        <br>
        <span style="color:#323b62">James Sewell,</span><br>
        <span style="color:#a9a9a9"><span style="font:12px Arial,Helvetica,sans-serif">PostgreSQL Team Lead / Solutions Architect </span></span><br>
        <span style="color:#a9a9a9">______________________________________</span><br>
         </div>
<img alt="" src="http://www.lisasoft.com/sites/lisasoft/files/u1/logo1.jpg" style="margin:0px;width:153px;height:50px"><br>
<div style="font:normal 12px/20px Arial,Helvetica,sans-serif;color:#404040;margin:0">
        <span style="color:#a9a9a9">Level 2, 50 Queen St, Melbourne VIC 3000</span><br>
        <br>
        <strong>P </strong><span style="color:#a9a9a9"><span style="font-family:Arial,Verdana,sans-serif">(+61) 3 8370 8000</span></span><span style="color:rgb(169,169,169)"> </span><strong> </strong><span style="color:rgb(50,59,98)"><span style="width:15px;display:inline-block"><strong>W</strong></span></span> <a style="color:rgb(64,64,64);margin:2px 0px;text-decoration:none"><span style="color:#a9a9a9">www.lisasoft.com</span></a>  <span style="color:rgb(50,59,98)"><span style="width:15px;display:inline-block"><strong>F </strong></span></span><span style="color:#a9a9a9"><span style="font-family:Arial,Verdana,sans-serif">(+61) 3 8370 8099</span></span></div>

<div style="padding-top:8px">
         </div></div>
<br><br><div class="gmail_quote">On Wed, Jun 11, 2014 at 5:31 PM, Sandro Santilli <span dir="ltr"><<a href="mailto:strk@keybit.net" target="_blank">strk@keybit.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">On Wed, Jun 11, 2014 at 04:36:11PM +1000, James Sewell wrote:<br>
> Hi All,<br>
><br>
> I'm migrating from a legacy PostGIS system to a new one, and I want to<br>
> locate PostGIS in the postgis schema at the same time.<br>
><br>
> Most of the time this works fine, but when people have defined things like:<br>
><br>
> CREATE TABLE metro (<br>
>     ogc_fid integer DEFAULT nextval('metro_ogc_fid_seq'::regclass) NOT NULL,<br>
>     wkb_geometry public.geometry,<br>
>     id numeric(6,0),<br>
>     CONSTRAINT enforce_dims_wkb_geometry CHECK<br>
> ((public.st_ndims(wkb_geometry) = 2)),<br>
>     CONSTRAINT enforce_srid_wkb_geometry CHECK<br>
> ((public.st_srid(wkb_geometry) = 4283))<br>
> );<br>
><br>
> the whole thing falls apart, as it looks specifically for public.geometry etc...<br>
><br>
> Can anyone think of a smart way of fixing this on the fly? I'm using<br>
> <a href="http://postgis_restore.pl" target="_blank">postgis_restore.pl</a>, which means I'm using pg_restore, which means that<br>
> I can't edit the SQL as I have a binary dump.<br>
><br>
> I know I can fix manually on the source database (ALTER), or I can<br>
> import these tabels manually - but I am hoping there is a way to<br>
> automate this.<br>
<br>
</div>I think adding a switch to <a href="http://postgis_restore.pl" target="_blank">postgis_restore.pl</a> could be a good idea.<br>
The perl script parses the whole sql anyway, so it could be a way<br>
to replace "public.<any_postgis_object>" with "<target_schema>.\1"<br>
<br>
--migrate-postgis-schema ?<br>
<br>
Looking forward for your patch ! :)<br>
<br>
--strk;<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br></div>

<br>
<p><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14.545454025268555px;background-color:rgb(255,255,255)"><hr><font size="1" color="Gray" face="Arial">The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.</font></div></p>