PostgreSQL error: syntax error at or near

ERROR:  syntax error at or near "order"
LINE 1: SELECT * FROM order;
                      ^

The parser hit a token it couldn't fit into any valid SQL and stopped. One reading tip changes everything: the caret marks where parsing gave up, which is at or just after the actual mistake — look at the flagged token and the few before it.

What this error means

This is a pure grammar error: the statement never got as far as looking up tables or columns. The quoted token in the message is where the grammar broke. In the sample, order is a reserved word (as in ORDER BY), so a table by that name can't appear unquoted — the parser reads it as the keyword and fails.

Common causes

How to diagnose it

How to fix it

🔍 The next error you'll meet after fixing this one: column does not exist — quoting and case rules for identifiers.