[libgda] Correction for bug #761529 (thanks to arthurnn gmail com)
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Correction for bug #761529 (thanks to arthurnn gmail com)
- Date: Sat, 6 Feb 2016 15:09:56 +0000 (UTC)
commit 91e87da6d30bf09a05fd0f6809bdbf2bff6dbe4a
Author: Vivien Malerba <malerba gnome-db org>
Date: Sat Feb 6 16:09:16 2016 +0100
Correction for bug #761529 (thanks to arthurnn gmail com)
libgda/sql-parser/parser.y | 5 ++++-
tests/parser/testdata.xml | 6 ++++++
2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/libgda/sql-parser/parser.y b/libgda/sql-parser/parser.y
index 3c61782..2987577 100644
--- a/libgda/sql-parser/parser.y
+++ b/libgda/sql-parser/parser.y
@@ -704,7 +704,10 @@ seltarget(T) ::= LP compound(S) RP as(A). {T = gda_sql_select_target_new (NULL);
gda_sql_select_target_take_alias (T, A);
gda_sql_select_target_take_select (T, S);
}
-
+seltarget(T) ::= LP compound(S) RP ID(A). {T = gda_sql_select_target_new (NULL);
+ gda_sql_select_target_take_alias (T, A);
+ gda_sql_select_target_take_select (T, S);
+}
%type selcollist {GSList *}
%destructor selcollist {g_slist_foreach ($$, (GFunc) gda_sql_select_field_free, NULL); g_slist_free ($$);}
diff --git a/tests/parser/testdata.xml b/tests/parser/testdata.xml
index 0a8fe00..1a3679d 100644
--- a/tests/parser/testdata.xml
+++ b/tests/parser/testdata.xml
@@ -1038,4 +1038,10 @@
<sql>SELECT * FROM "table"</sql>
<expected>{"statements":[{"statement":{"sql":"SELECT * FROM
\"table\"","stmt_type":"SELECT","contents":{"distinct":"false","fields":[{"expr":{"value":"*"}}],"from":{"targets":[{"expr":{"value":"\"table\""},"table_name":"\"table\""}]}}}}]}</expected>
</test>
+
+ <!-- Double quoting table name, works for PostgreSQL as well -->
+ <test id="bug761529">
+ <sql>SELECT foo.abc FROM (select abc from bar) foo</sql>
+ <expected>{"statements":[{"statement":{"sql":"SELECT foo.abc FROM (select abc from bar)
foo","stmt_type":"SELECT","contents":{"distinct":"false","fields":[{"expr":{"value":"foo.abc"},"field_name":"abc","table_name":"foo"}],"from":{"targets":[{"expr":{"select":{"contents":{"distinct":"false","fields":[{"expr":{"value":"abc"},"field_name":"abc"}],"from":{"targets":[{"expr":{"value":"bar"},"table_name":"bar"}]}}}},"as":"foo"}]}}}}]}</expected>
+ </test>
</testdata>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]