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

identifier ambiguous when grouping and selecting the same column twice #6207

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed
Labels
bug Something isn't working minor SQL

Comments

@monetdb-team
Copy link

Date: 2017-02-09 10:59:42 +0100
From: @swingbit
To: SQL devs <>
Version: 11.25.5 (Dec2016-SP1)
CC: @njnes

Last updated: 2017-10-26 14:01:33 +0200

Comment 24993

Date: 2017-02-09 10:59:42 +0100
From: @swingbit

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Build Identifier:

Starting from this, which works fine :

sql>select name,name from sys.functions group by name limit 2;
+-------------+-------------+
| name | name |
+=============+=============+
| mbr_overlap | mbr_overlap |
| mbr_above | mbr_above |
+-------------+-------------+
2 tuples (2.994ms)

The following, though pointless, should be allowed (group twice on the same column):

sql>select name, name from sys.functions group by name,name limit 2;
SELECT: identifier 'name' ambiguous

By using table qualifiers, it works again:

sql>select f.name, f.name from sys.functions AS f group by name,name limit 2;
+-------------+-------------+
| name | name |
+=============+=============+
| mbr_overlap | mbr_overlap |
| mbr_above | mbr_above |
+-------------+-------------+
2 tuples (4.035ms)

Not a serious issue, but table qualifiers should not be needed. The second attempt has no ambiguous identifiers, as far as I can see.

Reproducible: Always

$ mserver5 --version
MonetDB 5 server v11.25.6 (64-bit, 128-bit integers)
This is an unreleased version
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
Visit http://www.monetdb.org/ for further information
Found 15.6GiB available memory, 8 available cpu cores
Libraries:
libpcre: 8.40 2017-01-11 (compiled with 8.40)
openssl: OpenSSL 1.0.2j 26 Sep 2016 (compiled with OpenSSL 1.0.2j-fips 26 Sep 2016)
libxml2: 2.9.3 (compiled with 2.9.3)
Compiled by: roberto@photon.hq.spinque.com (x86_64-unknown-linux-gnu)
Compilation: gcc -g -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-protector-all -Wstack-protector -Wpacked-bitfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wunreachable-code
Linking : /usr/bin/ld -m elf_x86_64

Comment 25738

Date: 2017-10-16 08:55:38 +0200
From: MonetDB Mercurial Repository <>

Changeset 02c08819c11f made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=02c08819c11f

Changeset description:

fixed bug #6207, remove duplicate expressions in group by list.
@monetdb-team monetdb-team added bug Something isn't working minor SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor SQL
Projects
None yet
Development

No branches or pull requests

2 participants