[postgis-users] AddGeometryColumn() Question

Stephen Woodbridge woodbri at swoodbridge.com
Fri Jan 6 11:21:03 PST 2006


strk at refractions.net wrote:
> 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 ?

I like the idea of having a SanctifyGeometyColumn() or 
BlessGeometryColumn() to bless a column that was created via means other 
than AddGeometryColumn() which is not always the "best" way to create 
the table.

I am building a process to delete and reload vendor data on a quarterly 
basis from a table that has multiple data sets merged into it. We do 
this by copying an existing production table doing the updates to it 
then swap it into production.

-Steve



More information about the postgis-users mailing list