DBAtlas · Database operations atlas

42601: syntax_error

PostgreSQL

What does it mean?

A syntax error was found in the SQL statement. PostgreSQL could not parse the query and reports the approximate location (position) of the error.

Why does it happen?

A missing/extra comma or parenthesis; a reserved keyword (such as user, order) used as an unquoted column name; a missing semicolon; a misspelled command; an unterminated string literal; use of version-specific syntax.

How to fix it

Use the 'position' value in the error message to locate the problem; inspect the part immediately before it. Quote reserved words with double quotes: "order". Check that parentheses and quotes balance. Test a complex query by splitting it into pieces. Consult the documentation for your version for the correct syntax.

Open in DBAtlas →

More from this engine