Re: MonetDB: default - Support LIMIT in scalar expressions
maybe we could also support FIRST() and LAST()
https://www.monetdb.org/bugzilla/show_bug.cgi?id=6333
On Wed, Jul 12, 2017 at 11:22 AM, Martin Kersten
Changeset: 718758b70621 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=718758b70621 Modified Files: sql/server/sql_parser.y Branch: default Log Message:
Support LIMIT in scalar expressions Picking a single element from a table is now supported using LIMIT (and SAMPLE) in SET and UPDATE subqueries
set v =(select * from tbl limit 1);
diffs (21 lines):
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -772,7 +772,7 @@ set_statement: append_string(l, $2 ); append_symbol(l, $4 ); $$ = _symbol_create_list( SQL_SET, l); } - | set column_commalist_parens '=' subquery + | set column_commalist_parens '=' subquery_with_orderby { dlist *l = L(); append_list(l, $2); append_symbol(l, $4); @@ -2919,7 +2919,7 @@ assignment: append_symbol(l, $3 ); append_string(l, $1); $$ = _symbol_create_list( SQL_ASSIGN, l); } - | column_commalist_parens '=' subquery + | column_commalist_parens '=' subquery_with_orderby { dlist *l = L(); append_symbol(l, $3); append_list(l, $1); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
As Martin vD suggested in his comment in bug 6333, FIRST() and LAST() have no clearly defined (intuitive) semantics in set-oriented SQL --- even LIMIT n without order by does not, other some returning "any" n tuples, possibly different ones with each query invocation (i.e., not even "guaranteed" to be deterministic). Thus, maybe we could consider "ANY()" instead of "FIRST()" & "LAST()"? Stefan ----- On Jul 12, 2017, at 11:31 AM, Lefteris lsidir@gmail.com wrote:
maybe we could also support FIRST() and LAST()
https://www.monetdb.org/bugzilla/show_bug.cgi?id=6333
On Wed, Jul 12, 2017 at 11:22 AM, Martin Kersten
wrote: Changeset: 718758b70621 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=718758b70621 Modified Files: sql/server/sql_parser.y Branch: default Log Message:
Support LIMIT in scalar expressions Picking a single element from a table is now supported using LIMIT (and SAMPLE) in SET and UPDATE subqueries
set v =(select * from tbl limit 1);
diffs (21 lines):
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -772,7 +772,7 @@ set_statement: append_string(l, $2 ); append_symbol(l, $4 ); $$ = _symbol_create_list( SQL_SET, l); } - | set column_commalist_parens '=' subquery + | set column_commalist_parens '=' subquery_with_orderby { dlist *l = L(); append_list(l, $2); append_symbol(l, $4); @@ -2919,7 +2919,7 @@ assignment: append_symbol(l, $3 ); append_string(l, $1); $$ = _symbol_create_list( SQL_ASSIGN, l); } - | column_commalist_parens '=' subquery + | column_commalist_parens '=' subquery_with_orderby { dlist *l = L(); append_symbol(l, $3); append_list(l, $1); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
ANY() sounds good too!
On Wed, Jul 12, 2017 at 12:32 PM, Stefan Manegold
As Martin vD suggested in his comment in bug 6333, FIRST() and LAST() have no clearly defined (intuitive) semantics in set-oriented SQL --- even LIMIT n without order by does not, other some returning "any" n tuples, possibly different ones with each query invocation (i.e., not even "guaranteed" to be deterministic).
Thus, maybe we could consider "ANY()" instead of "FIRST()" & "LAST()"?
Stefan
----- On Jul 12, 2017, at 11:31 AM, Lefteris lsidir@gmail.com wrote:
maybe we could also support FIRST() and LAST()
https://www.monetdb.org/bugzilla/show_bug.cgi?id=6333
On Wed, Jul 12, 2017 at 11:22 AM, Martin Kersten
wrote: Changeset: 718758b70621 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=718758b70621 Modified Files: sql/server/sql_parser.y Branch: default Log Message:
Support LIMIT in scalar expressions Picking a single element from a table is now supported using LIMIT (and SAMPLE) in SET and UPDATE subqueries
set v =(select * from tbl limit 1);
diffs (21 lines):
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -772,7 +772,7 @@ set_statement: append_string(l, $2 ); append_symbol(l, $4 ); $$ = _symbol_create_list( SQL_SET, l); } - | set column_commalist_parens '=' subquery + | set column_commalist_parens '=' subquery_with_orderby { dlist *l = L(); append_list(l, $2); append_symbol(l, $4); @@ -2919,7 +2919,7 @@ assignment: append_symbol(l, $3 ); append_string(l, $1); $$ = _symbol_create_list( SQL_ASSIGN, l); } - | column_commalist_parens '=' subquery + | column_commalist_parens '=' subquery_with_orderby { dlist *l = L(); append_symbol(l, $3); append_list(l, $1); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) | _______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
participants (2)
-
Lefteris
-
Stefan Manegold