Skip to content

Fix ambiguous column references in spatial queries #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bwdmr
Copy link

@bwdmr bwdmr commented May 17, 2025

Resolves an issue where column references were becoming ambiguous in complex joins involving geometry columns. This change modifies the path generation to explicitly qualify columns with their schema or table alias, replacing the previous approach that created unqualified column names. Specifically, we now prepend the schema or alias name with a dot separator before the column path, ensuring proper SQL column qualification.

This prevents errors like "column reference is ambiguous" when using spatial functions on tables with similar column names in multi-table joins.

@bwdmr
Copy link
Author

bwdmr commented Jul 7, 2025

this adds a missing alias in complex joins involving geometry columns.

if a geometry column is referenced multiple times the alias is necessary to prevent ambigous column reference error.

Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! Can you add a test showing an example of using a join?

@bwdmr
Copy link
Author

bwdmr commented Aug 8, 2025

id need this to merge.

#9

Resolves an issue where column references were becoming ambiguous in complex
joins involving geometry columns. This change modifies the path generation
to explicitly qualify columns with their schema or table alias, replacing
the previous approach that created unqualified column names. Specifically,
we now prepend the schema or alias name with a dot separator before the
column path, ensuring proper SQL column qualification.

This prevents errors like "column reference is ambiguous" when using spatial
functions on tables with similar column names in multi-table joins.

Signed-off-by: bwdmr <[email protected]>
@bwdmr
Copy link
Author

bwdmr commented Aug 8, 2025

the warnings it seemed i couldnt remove due to errors appearing once i remove any unused members from the if case statement.

the errors appearing on psql about sensitive data leakage are presumably a disabled postgis extension manually enabled.
does this extension enabler have to be removed for action runners to test correctly?

afaik it doesnt harm to enable the extension twice, except i am mistaken and it is something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants