ERROR: invalid input syntax for integer: "INSERT"

Started by Robert Lakesover 8 years ago2 messagesgeneral
Jump to latest
#1Robert Lakes
robertl@propaas.com

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 attempting to insert a record
into a table:

ERROR: invalid input syntax for integer: "INSERT"
LINE 1: ...T INTO listings_cdc SELECT statement_timestamp(), 'INSERT', ...
^
QUERY: INSERT INTO listings_cdc SELECT statement_timestamp(), 'INSERT',
$1.*
CONTEXT: PL/pgSQL function audit_func() line 28 at EXECUTE

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Robert Lakes (#1)
Re: ERROR: invalid input syntax for integer: "INSERT"

On Saturday, November 4, 2017, Robert Lakes <robertl@propaas.com> wrote:

Here's the error I am receiving - when I am attempting to insert a record
into a table:

ERROR: invalid input syntax for integer: "INSERT"
LINE 1: ...T INTO listings_cdc SELECT statement_timestamp(), 'INSERT', ...

The second column of listings_cdc has a type of integer. The word INSERT
is not a valid value to store there.

David J.