Seaquel
PostgreSQL error code

PostgreSQL error 42P10

42P10 is the SQLSTATE PostgreSQL reports for invalid column reference, in class 42, Syntax Error or Access Rule Violation.

SQLSTATE42P10
Condition nameinvalid_column_reference
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 DISTINCT country
FROM demo.customers
ORDER BY created_at;
SELECT country
FROM demo.customers
GROUP BY country
ORDER BY MIN(created_at);

How to fix it

In other databases

Source: PostgreSQL documentation, Appendix A