PostgreSQL Syntax Checker
Check PostgreSQL queries for syntax errors: :: casts, double-quoted identifiers, RETURNING, ILIKE, DISTINCT ON and ON CONFLICT upserts are supported.
PostgreSQL errors this catches, and how to fix them
- Backtick identifiers. Backticks are MySQL syntax. PostgreSQL uses "double quotes", and quoted names become case-sensitive.
- Double quotes for strings. "text" is an identifier in PostgreSQL. String literals use single quotes.
- Mixed-case names. Unquoted names are folded to lowercase, so a table created as "Users" must always be written "Users".
- LIMIT x, y. MySQL’s comma form is invalid here. Write LIMIT y OFFSET x.
- Column aliases in WHERE. Aliases defined in SELECT don’t exist yet in WHERE. Repeat the expression or use a subquery.
Need to move this query to another database? The SQL dialect converter rewrites it and lists every change. To make it readable first, use the SQL formatter.
Other dialects
MySQL Syntax Checker · SQL Server Syntax Checker · SQLite Syntax Checker · MariaDB Syntax Checker · BigQuery SQL Validator · Snowflake SQL Validator · Redshift SQL Validator · All dialects
Questions
Is this PostgreSQL syntax checker free and private?
Yes. The PostgreSQL grammar is downloaded once and your SQL is parsed in the browser, so nothing is uploaded. Only the optional “Explain & fix with AI” button sends the failing statement to an AI model.
Does it check that my PostgreSQL tables and columns exist?
No. It checks syntax only, because it never connects to your database. Valid statements list the tables and columns they reference so you can compare them yourself; EXPLAIN on a development database checks the names for real.
Which PostgreSQL versions are covered?
The grammar comes from the open-source node-sql-parser project and targets current PostgreSQL syntax. Very new features or vendor extensions can be flagged as errors even when the server accepts them; confirm those with the official PostgreSQL documentation.
Why does PostgreSQL reject backtick identifiers?
Backticks are MySQL syntax. PostgreSQL uses "double quotes", and quoted names become case-sensitive.
Why does PostgreSQL reject double quotes for strings?
"text" is an identifier in PostgreSQL. String literals use single quotes.
Related tools
- SQL ValidatorCheck syntax for MySQL, PostgreSQL, SQL Server, SQLite and BigQuery, with the exact line and column.
- SQL FormatterBeautify SQL in 12 dialects with keyword case, indent and comma style options.
- SQL Dialect ConverterRewrite SQL from MySQL to PostgreSQL, SQL Server, SQLite and more, with every change listed.
- Text to SQLDescribe what you want in plain English and get a query that uses your real schema.