Redrock Postgres Documentation
Home Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

42702 Ambiguous Column

ERROR: column reference is ambiguous

You may encounter an error message like following.

ERROR: column reference "z" is ambiguous at character 8
STATEMENT: SELECT z FROM x, y

This error occurs when the referenced column can’t be resolved unambiguously. This may occur when you have two tables that have columns with the same name.

In the example above, you would resolve this by adding an explicit table name like this:

SELECT x.z FROM x, y

Solution:

Fix your query to include the specific table or view that the column belongs to.