Seaquel
PostgreSQL error code

PostgreSQL error 42601

42601 is the SQLSTATE PostgreSQL reports for syntax error, in class 42, Syntax Error or Access Rule Violation.

SQLSTATE42601
Condition namesyntax_error
Class42 — Syntax Error or Access Rule Violation

Reproduce it, then fix it

These are the queries from the guide below. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

SELECT first_name, last_name, email
FROM demo.customers
UNION
SELECT name, category
FROM demo.products;
SELECT first_name || ' ' || last_name AS label, 'customer' AS kind
FROM demo.customers
UNION ALL
SELECT name, 'product'
FROM demo.products;

How to fix it

In other databases

Source: PostgreSQL documentation, Appendix A