After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 761529 - Inner query alias without the `AS`dont work
Inner query alias without the `AS`dont work
Status: RESOLVED FIXED
Product: libgda
Classification: Other
Component: general
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: malerba
gnome-db Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-02-04 03:03 UTC by arthurnn
Modified: 2016-02-06 15:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Support for inner queries alias without the `AS` (1.34 KB, patch)
2016-02-04 03:09 UTC, arthurnn
none Details | Review

Description arthurnn 2016-02-04 03:03:37 UTC
The query: SELECT foo.abc FROM (select abc from bar) foo; 

When parsing the query, gda_sql_parser_parse_string, mark the top node as UNKNOWN instead of a Select.

That is a valid query on sqlite3 and mysql, see:

sqlite> create table bar(abc varchar(10));
sqlite> insert into bar values('hi');
sqlite> SELECT foo.abc FROM (select abc from bar) foo;
hi


Seems like that syntax was not handled by the parser.y lemon file. So I have a patch for it: 
https://github.com/arthurnn/libgda/commit/0ba0e8f49f90304256e4fca637928d8cad55a1e0

I also sent the patch through the mailing list, but let me know if you need more info.

Thanks
Comment 1 arthurnn 2016-02-04 03:09:01 UTC
Created attachment 320401 [details] [review]
Support for inner queries alias without the `AS`
Comment 2 malerba 2016-02-06 15:12:26 UTC
Patch committed, see https://git.gnome.org/browse/libgda/commit/?id=91e87da6d30bf09a05fd0f6809bdbf2bff6dbe4a
Thanks!