U116: INSERT has more expressions than target columns
SQLSTATE: 42601 (Class 42 — Syntax Error or Access Rule Violation: syntax_error)
Example Postgres Log Output:
ERROR: INSERT has more expressions than target columns at character 341 STATEMENT: INSERT INTO x(y) VALUES (1, 2)
In the case of this log event, you specified the wrong number of columns in the target list part of an INSERT statement, or passed in too many/not enough values per row.
For example, you might have sent this:
INSERT INTO my_table (column_a, column_b) VALUES (1,2,3), (4,5,6);
Instead of this:
INSERT INTO my_table (column_a, column_b, column_c) VALUES (1,2,3), (4,5,6);
This typically occurs due to a bug in your ORM-related logic, or when you manually construct the SQL for INSERT statements.
Fix the syntax generated by your application code or ORM.
Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →