-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
sql: support for SELECT with no projections #83255
Comments
I found that the following patch immediately delivers the functionality, without any other change: diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y
index 64cec45f2e..438b25f390 100644
--- a/pkg/sql/parser/sql.y
+++ b/pkg/sql/parser/sql.y
@@ -1298,7 +1298,7 @@ func (u *sqlSymUnion) asTenantClause() tree.TenantID {
%type <*tree.Tuple> expr_tuple1_ambiguous expr_tuple_unambiguous
%type <tree.NameList> attrs
%type <[]string> session_var_parts
-%type <tree.SelectExprs> target_list
+%type <tree.SelectExprs> target_list opt_target_list
%type <tree.UpdateExprs> set_clause_list
%type <*tree.UpdateExpr> set_clause multiple_set_clause
%type <tree.ArraySubscripts> array_subscripts
@@ -10144,7 +10144,7 @@ simple_select:
// [ OFFSET <expr> [ ROW | ROWS ] ]
// %SeeAlso: WEBDOCS/select-clause.html
simple_select_clause:
- SELECT opt_all_clause target_list
+ SELECT opt_all_clause opt_target_list
from_clause opt_where_clause
group_clause having_clause window_clause
{
@@ -10183,10 +10183,9 @@ simple_select_clause:
Where: tree.NewWhere(tree.AstWhere, $5.expr()),
GroupBy: $6.groupBy(),
Having: tree.NewWhere(tree.AstHaving, $7.expr()),
Window: $8.window(),
}
}
-| SELECT error // SHOW HELP: SELECT
set_operation:
select_clause UNION all_or_distinct select_clause
@@ -13486,6 +13485,10 @@ opt_asymmetric:
ASYMMETRIC {}
| /* EMPTY */ {}
+opt_target_list:
+ target_list { $$.val = $1.selExprs() }
+| /* EMPTY */ { $$.val = tree.SelectExprs{} }
+
target_list:
target_elem
{ However, I am bummed out that it requires removing the I wasn't able to find a way to keep the |
Hi query team, this feature is also needed by Hasura Graphql Engine. They have a workaround already, but still curious do we have a timeline for supporting this? |
Postgres allows this syntax to
SELECT
from a table with no projections.This is not supported by CockroachDB.
Jira issue: CRDB-16953
The text was updated successfully, but these errors were encountered: