enumCastSpelling
enum CastSpelling
Public API: explicitly declared with
@visibility public.How a type cast is written.
x::t and CAST(x AS t) request the same conversion; the grammar keeps them as different token sequences, and only the operator form takes part in operator precedence. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-SYNTAX-TYPE-CASTS.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1::text');
$query->field(0)->expression->spelling // => \SqlSemantics\Platform\PostgreSql\Statement\Expression\CastSpelling::OperatorCases§
case OperatorThe postfix operator ::.
case FunctionThe function-like form CAST ( x AS t ).
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Other tests reaching this symbol 7
SyntaxRuleTest::testSpecialBuildsTheFunctionSpellingOfCastcallsColumnNamingTest::testNameOfACastOfACaseIsTheTypecallsCastTest::testDeriveScalarHasTheTargetTypeAndTheOperandNullabilitycallsCastTest::testOutputNameIsTheOperandNameWhenFirmcallsCastTest::testOutputNameIsTheTypeNameOtherwisecallsCastTest::testRejectsAnOperandThatBindsWeakercallsCastTest::testRenderWritesBothSpellingscalls
Relations§
Constant reads 5
- class-const SqlSemantics\Platform\PostgreSql\Lowering\Expression\OperatorRule::postfix() packages/sql-semantics-postgres/src/Lowering/Expression/OperatorRule.php:108
- class-const SqlSemantics\Platform\PostgreSql\Lowering\Invocation\SyntaxRule::special() packages/sql-semantics-postgres/src/Lowering/Invocation/SyntaxRule.php:112
- class-const SqlSemantics\Platform\PostgreSql\Rules\Expression\Precedence::operators() packages/sql-semantics-postgres/src/Rules/Expression/Precedence.php:217
- class-const SqlSemantics\Platform\PostgreSql\Statement\Expression\Cast::__construct() packages/sql-semantics-postgres/src/Statement/Expression/Cast.php:55
- class-const SqlSemantics\Platform\PostgreSql\Statement\Expression\Cast::render() packages/sql-semantics-postgres/src/Statement/Expression/Cast.php:86