1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Make subquery aliases optional in the FROM clause.

This allows aliases for sub-SELECTs and VALUES clauses in the FROM
clause to be omitted.

This is an extension of the SQL standard, supported by some other
database systems, and so eases the transition from such systems, as
well as removing the minor inconvenience caused by requiring these
aliases.

Patch by me, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCUCGCf82=hxd9N5n6xGHPyYpQnxW8HneeH+uP7yNALkWA@mail.gmail.com
This commit is contained in:
Dean Rasheed
2022-07-20 09:29:42 +01:00
parent 1caf915ff3
commit bcedd8f5fc
10 changed files with 164 additions and 81 deletions

View File

@ -11725,7 +11725,11 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
else if (rte->rtekind == RTE_SUBQUERY ||
rte->rtekind == RTE_VALUES)
{
/* Alias is syntactically required for SUBQUERY and VALUES */
/*
* For a subquery, always print alias. This makes the output SQL
* spec-compliant, even though we allow the alias to be omitted on
* input.
*/
printalias = true;
}
else if (rte->rtekind == RTE_CTE)