Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE master.parties
- (
- party_key serial NOT NULL,
- name text,
- date_of_birth date,
- phone text,
- CONSTRAINT "PK_master_parties" PRIMARY KEY (party_key)
- )
- CREATE TABLE corporate.parties
- (
- corp_key integer,
- corp_role text
- ) INHERITS (master.parties)
- WITH deleted AS (
- DELETE FROM ONLY master.parties
- WHERE party_key = 1
- returning *
- )
- INSERT INTO corporate.parties (name, date_of_birth, phone, corp_key, corp_role)
- SELECT name, date_of_birth, phone, 2, 'President'
- from deleted;
Add Comment
Please, Sign In to add comment