Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
1a02edae
Commit
1a02edae
authored
24 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Give a good error message for what's likely to be a common syntax error,
namely omitting the alias clause for a sub-SELECT in FROM.
parent
e832ae33
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/parser/gram.y
+18
-5
18 additions, 5 deletions
src/backend/parser/gram.y
with
18 additions
and
5 deletions
src/backend/parser/gram.y
+
18
−
5
View file @
1a02edae
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.21
6
2001/01/
17
17:
26:45 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.21
7
2001/01/
20
17:
37:52 tgl
Exp $
*
*
* HISTORY
* HISTORY
* AUTHOR DATE MAJOR EVENT
* AUTHOR DATE MAJOR EVENT
...
@@ -3604,10 +3604,6 @@ from_list: from_list ',' table_ref { $$ = lappend($1, $3); }
...
@@ -3604,10 +3604,6 @@ from_list: from_list ',' table_ref { $$ = lappend($1, $3); }
* between table_ref := '(' joined_table ')' alias_clause
* between table_ref := '(' joined_table ')' alias_clause
* and joined_table := '(' joined_table ')'. So, we must have the
* and joined_table := '(' joined_table ')'. So, we must have the
* redundant-looking productions here instead.
* redundant-looking productions here instead.
*
* Note that the SQL spec does not permit a subselect (<derived_table>)
* without an alias clause, so we don't either. This avoids the problem
* of needing to invent a refname for an unlabeled subselect.
*/
*/
table_ref: relation_expr
table_ref: relation_expr
{
{
...
@@ -3618,6 +3614,23 @@ table_ref: relation_expr
...
@@ -3618,6 +3614,23 @@ table_ref: relation_expr
$1->name = $2;
$1->name = $2;
$$ = (Node *) $1;
$$ = (Node *) $1;
}
}
| select_with_parens
{
/*
* The SQL spec does not permit a subselect
* (<derived_table>) without an alias clause,
* so we don't either. This avoids the problem
* of needing to invent a unique refname for it.
* That could be surmounted if there's sufficient
* popular demand, but for now let's just implement
* the spec and see if anyone complains.
* However, it does seem like a good idea to emit
* an error message that's better than "parse error".
*/
elog(ERROR, "sub-SELECT in FROM must have an alias"
"\n\tFor example, FROM (SELECT ...) [AS] foo");
$$ = NULL;
}
| select_with_parens alias_clause
| select_with_parens alias_clause
{
{
RangeSubselect *n = makeNode(RangeSubselect);
RangeSubselect *n = makeNode(RangeSubselect);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment