Skip to content

Instantly share code, notes, and snippets.

@JerrySievert
Created November 14, 2012 00:24
Show Gist options
  • Save JerrySievert/4069347 to your computer and use it in GitHub Desktop.
Save JerrySievert/4069347 to your computer and use it in GitHub Desktop.
trigger issue
DROP TABLE test_table CASCADE;
CREATE TABLE test_table (
id SERIAL PRIMARY KEY,
data VARCHAR
);
CREATE TABLE test_table_part () INHERITS (test_table);
CREATE OR REPLACE FUNCTION test_trigger_pre () RETURNS TRIGGER AS $$
BEGIN
INSERT INTO test_table_part VALUES (NEW.*);
RETURN NULL;
END;
$$
LANGUAGE 'plpgsql';
CREATE TRIGGER test_partitioner BEFORE INSERT ON test_table FOR EACH ROW EXECUTE PROCEDURE test_trigger_pre();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment