You are right Sebastien, <br>I should have mentioned the above template
is not ideal for production as it grants PUBLIC all privileges on
geometry_columns &amp; spatial_ref_sys. <br><br>For production you
will probably want to change the ownership of geometry_columns &amp;
spatial_ref_sys tables to the user creating the database and revoke it
from public.
<br><br>The only way I can think of doing that is to write a plpgsql
script or a shell script that will make the changes AFTER the database
has been created using the template_postgis using ALTER commands Chander suggested. <br><br>it will probably contain something like:<br><br>REVOKE ALL ON geometry_columns FROM PUBLIC<br>GRANT ALL ON geometry_columns TO &lt;user&gt;
<br>
<br>Anyone else had any experience with being able to do this at the time the database is created from the template?<br><br>Let us know if you do write something ...<br><font color="#888888">Shoaib</font><br><br><div class="gmail_quote">
On Dec 18, 2007 11:40 PM, Chander Ganesan &lt;<a href="mailto:chander@otg-nc.com">chander@otg-nc.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



  

<div bgcolor="#ffffff" text="#000000">
Sebastien ARBOGAST wrote:
<blockquote type="cite"><div class="Ih2E3d">
  <pre>I still have one problem with this procedure. The owner of
template_postgis is the user with which I created it, in this case
postgres. And when I create a new database based on this template,
both geometry_columns and spatial_ref_sys have their owner set to
postgres instead of the owner of the new database.
  </pre></div>
</blockquote>
When you create a database, the database itself is owned by the user
that issued the create database command....if that user was &#39;postgres&#39;,
then he/she would own the database.&nbsp; If you look at the syntax of the
create database command, they you&#39;ll see how you can set the owner of a
DB when you create the DB.&nbsp; However, I suspect that isn&#39;t your problem.<br>
<br>
Instead, I think that you have a schema or other objects in the
&#39;template_postgis&#39; database that is owned by the user &#39;postgres&#39;.&nbsp; That
schema, along with any other permissions *inside* the database are
copied &quot;as is&quot; when creating a new database (regardless of the database
owner).&nbsp;&nbsp; As such, you should change the ownership of the schema so
that it&#39;s owned by the appropriate user (the same would go for any
tables, indexes, etc. inside the database that you want owned by
someone else).<br>
<br>
I recommend you check out the online help for &#39;ALTER SCHEMA&#39;, &#39;ALTER
TABLE&#39;, &#39;ALTER SEQUENCE&#39;, and the other related commands to see how to
change the ownership of the objects you want to change.<br>
<br>
Hope that helps.<br>
<br>
Chander<div><div></div><div class="Wj3C7c"><br>
<blockquote type="cite">
  <pre>Is it normal? Is there a way to change that?

2007/12/16, Sebastien ARBOGAST <a href="mailto:sebastien.arbogast@gmail.com" target="_blank">&lt;sebastien.arbogast@gmail.com&gt;</a>:
  </pre>
  <blockquote type="cite">
    <pre>Yes! That worked great. Thanks to both of you.

2007/12/16, LuVar <a href="mailto:varga.lubomir@orangemail.sk" target="_blank">&lt;varga.lubomir@orangemail.sk&gt;</a>:
    </pre>
    <blockquote type="cite">
      <pre>Jop. I get also the same. Just try to disconnect in pgAdmin and
reconnect. Than click ONLY on that database, in which you want to do
somethink. Dont open &quot;template_postgis&quot; table. You must have an red
cross iccon on &quot;template_postgis&quot; database.

Try, and good luck.

Sunday, December 16, 2007, 3:25:11 PM, you wrote:

      </pre>
      <blockquote type="cite">
        <pre>I just did that and I can&#39;t create a database based on template_postgis.
        </pre>
      </blockquote>
      <blockquote type="cite">
        <pre>When I try to do it via pgAdmin, I get a message saying that &quot;Source
database &quot;template_postgis&quot; is being accessed by other users
        </pre>
      </blockquote>
      <blockquote type="cite">
        <pre>When I try to run the command in terminal, I get the following message:
        </pre>
      </blockquote>
      <blockquote type="cite">
        <pre>createdb: could not connect to database template1: could not translate
host name &quot;tagspot_local&quot; to address: nodename nor servname provided,
or not known
        </pre>
      </blockquote>
      <pre>      </pre>
      <blockquote type="cite">
        <pre>2007/12/16, Shoaib Burq <a href="mailto:shoaib@nomad-labs.com" target="_blank">&lt;shoaib@nomad-labs.com&gt;</a>:
        </pre>
        <blockquote type="cite">
          <pre>Sebastian, please see:
<a href="http://geospatial.nomad-labs.com/2007/12/16/template-postgis-database/" target="_blank">http://geospatial.nomad-labs.com/2007/12/16/template-postgis-database/</a>
shoaib


 On Dec 16, 2007 10:15 AM, Sebastien ARBOGAST <a href="mailto:sebastien.arbogast@gmail.com" target="_blank">&lt;sebastien.arbogast@gmail.com&gt;</a>
wrote:
          </pre>
          <blockquote type="cite">
            <pre>Hi,

I&#39;ve just installed postgresql 8.2.5 and postgis 1.3.2 on my mac and
everything works great so far. Now I&#39;m just looking for a way to
simplify the creation of postgis-enabled databases in pgAdmin.
I saw that in the Windows distribution, there is a template to do so,
but there is no such template in my installation. Knowing that it&#39;s
the first time that I use postgresql and postgis, is there a way to
create such a template?


--
Sébastien Arbogast

<a href="http://www.sebastien-arbogast.com" target="_blank">http://www.sebastien-arbogast.com</a>
_______________________________________________
postgis-users mailing list
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a>

            </pre>
          </blockquote>
          <pre><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
          </pre>
          <pre>          </pre>
        </blockquote>
      </blockquote>
      <pre>--
Best regards,
 LuVar                            <a href="mailto:varga.lubomir@orangemail.sk" target="_blank">mailto:varga.lubomir@orangemail.sk</a>

_______________________________________________
postgis-users mailing list
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>

      </pre>
    </blockquote>
    <pre>--
Sébastien Arbogast

<a href="http://www.sebastien-arbogast.com" target="_blank">http://www.sebastien-arbogast.com</a>

    </pre>
  </blockquote>
  <pre>  </pre>
</blockquote>
<br>
<br>
</div></div><pre cols="72">-- 
Chander Ganesan
The Open Technology Group
One Copley Parkway, Suite 210
Morrisville, NC  27560
Phone: 877-258-8987/919-463-0999
<a href="http://www.otg-nc.com" target="_blank">http://www.otg-nc.com</a>
</pre>
</div>

<br>_______________________________________________<br>postgis-users mailing list<br><a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">
http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br><br></blockquote></div><br>