<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
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>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/docs/Populate_Geometry_Columns.html">http://postgis.refractions.net/docs/Populate_Geometry_Columns.html</a><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 cite="mid:764714.61449.qm@web110801.mail.gq1.yahoo.com"
type="cite">
<style type="text/css"><!-- DIV {margin:0px;} --></style>
<div
style="font-family: 'Courier New',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 wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
</pre>
</blockquote>
</body>
</html>