[postgis-users] How to setup a versioned datastore?

Lee quimby5 at yahoo.com
Tue Aug 3 12:02:10 PDT 2010


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 <graham.rick at gmail.com>
To: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
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 <georger.silva at gmail.com> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100803/a4680cd4/attachment.html>


More information about the postgis-users mailing list