classColumnNaming
final class ColumnNaming
Names an unaliased result column after its expression, with the strength PostgreSQL gives each name.
Rule: PG-COLUMN-NAMING-001 (FigureColname). A column reference, a function call and the function-like constructs name the column firmly (strength 2). A cast names it after its operand when the operand names it firmly, and otherwise weakly (strength 1) after the type; a typed constant is a cast of a constant. CASE names it after its ELSE result when that names it firmly, and otherwise weakly case. An indirection names it after the last field it selects, and otherwise as its base does; parentheses and COLLATE pass the operand's name through. Any other expression gives no name (strength 0), and the query names the column ?column?. Termination: each step descends one operand of a finite tree. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-SELECT-LIST, https://github.com/postgres/postgres/blob/REL_17_2/src/backend/parser/parse_target.c. Status: Implemented.
Methods§
Answers the name an expression gives an unaliased result column, or null.
Parameters
$expression | Scalar |
Returns
?NameTest cases 1
Called from 5
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Cast::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Cast.php:63
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Collation::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Collation.php:58
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Constructor\CaseExpression::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Constructor/CaseExpression.php:61
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Grouped::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Grouped.php:53
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Indirection::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Indirection.php:75
Calls 1
- method-call ColumnNaming::figure() line 42
Answers the name an expression gives a result column and its strength: 0 none, 1 weak, 2 firm.
Parameters
$expression | Scalar |
Returns
array{Name|null, int}Test cases 1
Called from 5
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\ColumnNaming::name() packages/sql-semantics-postgres/src/Rules/Expression/ColumnNaming.php:42
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\ColumnNaming::figure() packages/sql-semantics-postgres/src/Rules/Expression/ColumnNaming.php:53
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\ColumnNaming::figure() packages/sql-semantics-postgres/src/Rules/Expression/ColumnNaming.php:56
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\ColumnNaming::figure() packages/sql-semantics-postgres/src/Rules/Expression/ColumnNaming.php:64
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\ColumnNaming::figure() packages/sql-semantics-postgres/src/Rules/Expression/ColumnNaming.php:74
Calls 3
- method-call ColumnNaming::figure() line 53
- new Name line 66
- method-call Scalar::outputName() line 76
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Relations§
Instantiated in 5
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\Cast::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Cast.php:63
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\Collation::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Collation.php:58
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\Constructor\CaseExpression::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Constructor/CaseExpression.php:61
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\Grouped::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Grouped.php:53
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\Indirection::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Indirection.php:75
Method calls 5
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Cast::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Cast.php:63
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Collation::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Collation.php:58
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Constructor\CaseExpression::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Constructor/CaseExpression.php:61
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Grouped::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Grouped.php:53
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Indirection::outputName() packages/sql-semantics-postgres/src/Statement/Expression/Indirection.php:75