Skip to content
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

Ambiguous Column References Should Error #6490

Closed
2 tasks done
danfrankj opened this issue Feb 27, 2023 · 8 comments
Closed
2 tasks done

Ambiguous Column References Should Error #6490

danfrankj opened this issue Feb 27, 2023 · 8 comments
Labels

Comments

@danfrankj
Copy link

danfrankj commented Feb 27, 2023

What happens?

When referencing an ambiguous column, it's safer to error than to silently rename.

Did a small survey:
MySQL & PostgreSQL error
sqlite does not

If default sqlite compat is desired then we'd love to be able to set a flag to error on these cases e.g.

/set DISALLLOW_AMBIGUOUS_COLUMNS 

To Reproduce

This returns 1 and should instead error

   SELECT foo FROM (
     SELECT *, 2 AS foo
     FROM (
       SELECT 1 AS foo
     )
   )

OS:

iOS

DuckDB Version:

0.7.0

DuckDB Client:

Python

Full Name:

Daniel Frank

Affiliation:

Watershed

Have you tried this on the latest master branch?

  • I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • I agree
@Mytherin
Copy link
Collaborator

I'm not opposed to adding a strict mode to disable column renaming (and perhaps a few other things). It's worth noting that the reason we opted for this behavior is because it is very easy to get duplicate columns in the event of joins, which then prevents you from running statements such as CREATE TABLE on them. For example, this errors in Postgres and MySQL as well for the same reason:

CREATE TABLE t1(id INT);
CREATE TABLE t2(id INT);
CREATE TABLE t3 as SELECT * FROM t1 JOIN t2 ON (t1.id=t2.id);
-- ERROR:  column "id" specified more than once

@danfrankj
Copy link
Author

We'd be very happy with a strict mode! And I suspect the number of bugs that could be found earlier with a strict mode would be very non-trivial.

@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label Jul 29, 2023
@Mytherin Mytherin removed the stale label Jul 31, 2023
@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label Oct 30, 2023
Copy link

This issue was closed because it has been stale for 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2023
@danfrankj
Copy link
Author

I'd still like to see this feature :) !

@Mytherin Mytherin reopened this Nov 29, 2023
@github-actions github-actions bot removed the stale label Nov 30, 2023
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label Feb 28, 2024
Copy link

This issue was closed because it has been stale for 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants