[postgis-devel] history management

strk strk at keybit.net
Thu Feb 25 10:03:50 PST 2010


On Thu, Feb 25, 2010 at 02:39:22PM -0300, George Silva wrote:
> Actually it could work in simple tables, but when you are registering
> history_tables the system updates geometry_columns.
> 
> I guess that's the only constraint.

And I see it enforces no srid or geometrytype check, which seems useful
to me I've to say. I'd also drop the messing of geometry_columns as
the user can always repopulate it later (and hopefuly will be eventually
turned into a view).

One thing I see is that the _history table is created with *all* fields
from the original table (using "like <orig>" construct). Wouldn't this
fail if any field in the original table has the same name of one of
the "management" fields ? Would it be hard to "escape" the names
so they have a forced prefix or something to avoid the clash ?

> The proposed version also has functions to turn off "logging", but for what
> i can remember, it doesn't mess with geometry_columns. It's just the
> registry process that involves a geometry.

I'm not sure I can follow here. I guess I'll make some tests and see
what happen. If you're interested, a first naive test following 
instructions in the README resulted in this:

NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "cases_history_pk" for table "cases_history"
CONTEXT:  SQL statement "CREATE TABLE public.cases_history(history_id serial not null,date_added timestamp not null default now(),date_deleted timestamp default null,last_operation varchar(30) not null,active_user varchar(90) not null default CURRENT_USER,current_version text not null,like public.cases,CONSTRAINT cases_history_pk primary key(history_id));"
PL/pgSQL function "postgis_enable_history" line 66 at EXECUTE statement
ERROR:  cannot EXECUTE a null querystring
CONTEXT:  PL/pgSQL function "postgis_enable_history" line 67 at EXECUTE statement

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://foo.keybit.net/~strk/services.html



More information about the postgis-devel mailing list