Check out our free eBook: "Best Practices for Optimizing Postgres Query Performance"Download Now

U122: Column reference is ambiguous

Category: Application / User Errors
SQLSTATE: 42702 and 42P09 (Class 42 — Syntax Error or Access Rule Violation: ambiguous_column and ambiguous_alias)
Urgency: low

Example Postgres Log Output:

ERROR: column reference "z" is ambiguous at character 8


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

Recommended Action:

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

Learn More:

No additional resources available.

Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →