42601 PostgreSQL Origin: Data OSI layer 7 · Application Last updated 13 Oct 2026

ERROR: syntax error at or near "x"

PostgreSQL couldn’t parse the SQL; the token shown is where parsing failed.

Exact message you may see syntax error at or near
Seen on: PostgreSQL

Meaning

Reserved words as identifiers (user, order, group), MySQL syntax (backticks, LIMIT x,y), missing commas, and placeholders ? instead of $1 are typical.

Common causes

  • Reserved word as a column/table name (user, order)
  • MySQL-specific syntax (backticks, LIMIT 10, 20)
  • ? placeholders instead of $1
  • Missing comma/parenthesis

⚡ Quick fix

  1. Double-quote identifiers that are reserved words ("user")
  2. Use LIMIT 20 OFFSET 10
  3. Use $1, $2 placeholders with node-postgres

Detailed fix by platform

PostgreSQL

  1. SELECT * FROM "user" ORDER BY created_at LIMIT 20 OFFSET 10;

How to diagnose

  1. Token — Which token is quoted?
  2. Dialect — MySQL-isms?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1064 — MySQL ERROR 1064 (42000): You have an error in your SQL syntax (MySQL)10641136 — MySQL ERROR 1136 (21S01): Column count doesn't match value count at row 1 (SQL)113642703 — PostgreSQL: ERROR: column "x" does not exist (PostgreSQL)42703aggregate in WHERE — ERROR: aggregate functions are not allowed in WHERE (use HAVING) / MySQL 1111 Invalid use of group function (SQL)aggregate in WHEREambiguous column — Column reference is ambiguous / Column 'id' in field list is ambiguous (MySQL 1052) (SQL)ambiguous columnGROUP BY — Column must appear in the GROUP BY clause / isn't in GROUP BY (MySQL 1055 only_full_group_by) (SQL)GROUP BYmissing FROM-clause — ERROR: missing FROM-clause entry for table "x" (PostgreSQL)missing FROM-clausereserved word — Syntax error because a reserved keyword (order, group, user, key) is used as a column or table name (SQL)reserved word42601

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.