ERROR: invalid input syntax for integer: "2021-06-15 16:41:52.647-04" (postgres)

Issue with writing to postgres. Works fine if I remove system.date.now(). See pics for Ignition script and postgres table.

GETTING BELOW ERROR:
caused by Exception: Error executing system.db.runPrepUpdate(INSERT INTO assembly_rework
VALUES(?,?,?,?,?,?,?), [22206152021, G05 AL, 90, TP10, Bos Ant, test, Tue Jun 15 16:41:52
EDT 2021], , , false, false)

caused by GatewayException: SQL error for “INSERT INTO assembly_rework
VALUES(?,?,?,?,?,?,?)”:
ERROR: invalid input syntax for integer: “2021-06-15 16:41:52.647-04”

caused by PSQLException: ERROR: invalid input syntax for integer: “2021-06-15 16:41:52.647-04”

image

Apologies, I am aware of the missing ‘?’ in the ‘query’ line on the picture. Accidentally left it off after testing without ‘system.date.now()’.

Your table has eight columns. With the timestamp you are supplying seven values. You simply can’t use the implicit form of INSERT if you don’t supply all columns, and in the order defined.

Explicitly supply the column names you are targeting. (In parentheses, between assembly_rework and VALUES.)

Ah sheesh, yep. Forgot to get rid of my ‘cycle’ column.
Which makes sense to the integer error.

Thank you!

1 Like

I’d still be explicit about the targeted column names, or some future DBA will break your [expletive].

3 Likes