[postgis-devel] [PostGIS] #180: History table example implementation
PostGIS
trac at osgeo.org
Wed Sep 9 04:39:17 PDT 2009
#180: History table example implementation
--------------------------+-------------------------------------------------
Reporter: pramsey | Owner: pimpaa
Type: enhancement | Status: assigned
Priority: medium | Milestone: postgis 1.5.0
Component: postgis | Version:
Resolution: | Keywords:
--------------------------+-------------------------------------------------
Comment (by pimpaa):
Hello Regina,
The main table is not affected. I tested it quickly when it was first
written, and everything was fine. The rules add other actions to
INSERTS/DELETES/UPDATES. Heres a examples of a generic insert rule
(rewritten, not using the actual function, but the desired output - check
line 115).
{{{
v_sql:= CREATE OR REPLACE RULE foo_history_insert as ON INSERT TO
public.foo
DO (
INSERT INTO history.foo_history VALUES(
DEFAULT, --history_id nextval()
DEFAULT, --date_added now()
NULL, --date_deleted
quote_literal('INSERT'), --operation
DEFAULT,
NEW.foo_id,
NEW.*)
);
}}}
All the tables created are inherited from the main table (check line 66 in
code).
If the add-in is not showing off desired behavior, please let me know :D,
and thanks for your concern.
The debate over triggers x rules are still a question, and i'm up for
taking any of those. Just let me know.
Also, this was written in 8.3, and i did not checked 8.4 for 8.4
funcionalities that could help/enhance the implementation.
Thanks regina!
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/180#comment:20>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS
More information about the postgis-devel
mailing list