<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:12pt"><div>Thankyou Kevin, </div><div>  I suppose that the oid of a table is what 'table2'::regclass returns.</div><div>  I wonder what the parameterless version of <span class="Apple-style-span" style="font-family: monospace; ">Populate_Geometry_Columns does, I can't see its description in the documentation.</span></div><div><span class="Apple-style-span" style="font-family: monospace; ">Henri</span></div><div><font class="Apple-style-span" face="monospace"><br></font></div><div><br></div><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt"><br><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b>
 Kevin Neufeld <kneufeld@refractions.net><br><b><span style="font-weight: bold;">To:</span></b> postgis-users@postgis.refractions.net<br><b><span style="font-weight: bold;">Sent:</span></b> Thu, September 16, 2010 5:53:04 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [postgis-users] (no subject)<br></font><br>




  
  


It's true that if you create a table in this manner, the geometry
column of <tt>table2 </tt>won't be registered with the geometry
column metadata information listed in <tt>geometry_columns</tt> (which
is often needed by third-party applications).  Further, the <tt>table2
</tt>table will be missing the usual 3 sanity check constraints usually
placed on a geometry column.  In other words, after table2 has been
created, you could theoretically update the geometry column to contain
mixed geometry types, projections, or dimensions - a sure source of
bugs in any application.<br>
<br>
<tt>Populate_Geometry_Columns()</tt> addresses these issues.<br><span>
<a target="_blank" href="http://postgis.refractions.net/docs/Populate_Geometry_Columns.html">http://postgis.refractions.net/docs/Populate_Geometry_Columns.html</a></span><br>
<br>
<tt>SELECT Populate_Geometry_Columns('table2'::regclass);<br>
</tt><br>
Cheers,<br>
Kevin<br>
<br>
<br>
On 9/16/2010 8:11 AM, Henri De Feraudy wrote:
<blockquote type="cite">
  
  <div style="font-family:courier, monaco, monospace, sans-serif;font-size:12pt;">
  <div>The SQL Cookbook recommends the following SQL code to copy a
table's structure from table1 to table2:</div>
  <div><br>
  </div>
  <div>create table table2 as select * from table1 where 1=0;</div>
  <div><br>
  </div>
  <div>What's great about this is that it obviates the need to know the
structure of table1.</div>
  <div><br>
  </div>
  <div>But what if table1 has a geometry column?</div>
  <div>As geometry column existence is recorded in some other tables it
doesnt look as if the above trick is doing enough.</div>
  <div>What's your suggestion?</div>
  <div>Henri</div>
  <div><br>
  </div>
  </div>
  <pre><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
postgis-users mailing list
<a rel="nofollow" class="moz-txt-link-abbreviated" ymailto="mailto:postgis-users@postgis.refractions.net" target="_blank" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><span>
<a target="_blank" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
  </span></pre>
</blockquote>


</div></div><div style="position:fixed"></div>


</div></body></html>