Closed northrivergeo closed 2 years ago
Sounds great. I can test out later.
I'm separating out the trigger functions by table into separate scripts just for easier code:
Cool - feel free to make it make more sense....because.......blargh.
So I've got that working now. The segid mimics the primary key (which also provides for the OIRID) - no one said it couldn't work that way - BUT - if it nerds to be changed it can.
In the centerline dataset there are 3 fields that Autoincrement (of sorts).
OIRID is referenced by the state and can't change for the 3 layers (address, esn, centerline). That is built by taking the ID field and adding "Henry_" to it. So you have 'Henry_1', 'Henry_2' etc.
Segid doesn't increment or do anything It needs to. We can do this one of two ways.
If we calculate it off the ID with an update trigger more or less it's something like:
CREATE OR REPLACE FUNCTION centerlines_segid() RETURNS TRIGGER AS ' BEGIN NEW.segid := new.id; RETURN NEW; END; ' language 'plpgsql';
CREATE TRIGGER update_centerlines_segid before insert on tn911.centerlines FOR EACH ROW EXECUTE PROCEDURE centerlines_segid();
I added this code to the create_vector_functions.sql script. It's not been tested.