For sure! I was just about to sit down this week and write something very 
similar.

I grabbed it from SVN and trying to make it work on postgres8.4/postgis1.4.   I 
got as far as select postgis_enable_history(schema,table,geom) but get the 
following error:

ERROR:  more than one row returned by a subquery used as an expression
CONTEXT:  SQL statement "SELECT  (SELECT column_name FROM 
information_schema.key_column_usage WHERE table_schema =  $1  AND table_name =  
$2 )"
PL/pgSQL function "postgis_enable_history" line 31 at assignment


I think maybe it doesn't account for tables with foreign keys??  As a test, I 
tried this:

select * from information_schema.key_column_usage where table_schema='base' and 
table_name = 'wtr_mainvalves'
"midlandgis_test";"base";"mainvalves_pkey";"midlandgis_test";"base";"wtr_mainvalves";"gid";1;

"midlandgis_test";"base";"mainvalves_owner_fkey";"midlandgis_test";"base";"wtr_mainvalves";"owner";1;1

"midlandgis_test";"base";"mainvalves_status_fkey";"midlandgis_test";"base";"wtr_mainvalves";"status";1;1


Furthermore, I tried enabling another table with no foreign keys - no problem 
there.  


Looking into the function code, it appears to be looking for a primary key to 
use in the history table, but I can't immediately see an easy way to 
differentiate between a pk and fk in the key_column table.


Anyone have any ideas?

Lee





________________________________
From: Rick <[email protected]>
To: PostGIS Users Discussion <[email protected]>
Sent: Tue, August 3, 2010 12:42:05 PM
Subject: Re: [postgis-users] How to setup a versioned datastore?


On Tue, Aug 3, 2010 at 12:17 PM, George Silva <[email protected]> wrote:

Hello Mark,
>
>Check the SVN
>
>http://svn.osgeo.org/postgis/tags/1.5.1/extras/history_table/
>
>
Wow!  This looks like just the thing for me.

Thanks George.

-- 
Cheers!
Rick
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to