[postgis-users] AddGeometryColumn() Question

strk at refractions.net strk at refractions.net
Fri Jan 6 06:57:33 PST 2006


On Fri, Jan 06, 2006 at 09:54:06AM -0500, Stephen Woodbridge wrote:
> Hi all,
> 
> When a create a table using
> 
> CREATE TABLE foobar AS SELECT ...
> SELECT * INTO TABLE foobar ...
> 
> The metadata and constraints that are created by AddGeometryColumn() are 
> not created.
> 
> What is the correct way to do this?

Create with AddGeometryColumn, then INSERT INTO .. SELECT .. FROM ..

> Can I use AddGeometryColumn() and specify the existing column in the new 
> table?

Nope :(

> Does it have the smarts to check if it already exists and continue only 
> updating the missing information and constraints?

No, it's dumb. I was thinking about this when working on topology support.
SQL/MM specs use a "santifier" function for this (read: use existing thing
making it a "special" thing), while AddGeometryColumn insists on creating
it. 

> Would it make sense to make it behave like this? exactly for this purpose?

Good question, what other people think ?

--strk;



More information about the postgis-users mailing list