U116: INSERT has more expressions than target columns

Category: Application / User Errors
SQLSTATE: 42601 (Class 42 — Syntax Error or Access Rule Violation: syntax_error)
Urgency: low

Example Postgres Log Output:

ERROR: INSERT has more expressions than target columns at character 341


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.

Recommended Action:

Fix the syntax generated by your application code or ORM.

Learn More:

Download Free eBook: The Top 6 Postgres Log Events
Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →