[GENERAL] ERROR: invalid input syntax for integer: "INSERT"

2017-11-04 Thread Robert Lakes
Guys, New to Postgres - here's my code inside an event trigger: ELSIF (TG_OP = 'INSERT') THEN EXECUTE format('INSERT INTO %I SELECT statement_timestamp(), ''INSERT'', $1.*', TG_TABLE_NAME || '_cdc') USING NEW; RETURN NEW; Here's the error I am receiving - when I am

[GENERAL] Adding 'serial' to existing column

2017-11-03 Thread Robert Lakes
I am new to Postgres and I am trying to build this SQL statement in my SQL script: ALTER TABLE listings_cdc ALTER COLUMN table_id SET DEFAULT nextval('tab_id_seq'); I am trying to build the above-stated command as a dynamic SQL statement: EXECUTE 'ALTER TABLE listings_cdc ALTER COLUMN table_id

Re: [GENERAL] ERROR: unexpected chunk number 0 (expected 1) for toast value 76753264 in pg_toast_10920100

2017-06-09 Thread Robert Lakes
Ha guys, I am new to postgress and I am trying to write my first function to insert, update or delete and trap errors as a result of the table not existing , the columns not exist or if any other error simply pass back the sqlstate here's my code can you help CREATE OR REPLACE FUNCTION