classBooleanLiteral
final class BooleanLiteral
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.The constant TRUE or FALSE.
Rule: PG-BOOLEAN-001. Facts: boolean, never NULL. Since PostgreSQL 15 the raw parser reads the keyword as a plain boolean constant (A_Const with a Boolean value, makeBoolAConst in gram.y), not as a cast to bool, so the expression gives an unaliased result column no name and the column is named ?column?. Source: https://www.postgresql.org/docs/17/datatype-boolean.html, https://www.postgresql.org/docs/17/sql-select.html#SQL-SELECT-LIST. Status: Implemented.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT TRUE');
[$query->statement->targets[0]->expression->value, $query->field(0)->name->value] // => [true, '?column?']Properties§
public bool $valueMethods§
public function __construct(public bool $value)Parameters
$value | bool | The truth value |
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives boolean, never NULL.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- new ScalarFact line 49
- new Known line 49
- class-const Builtin::Bool() line 49
- class-const Nullability::NotNull() line 49
public function render(Output $out): voidTest cases 21§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 19
LiteralsTest::testConstantLowersEveryPlainConstantcallsColumnNamingTest::testNameOfACastOfACaseIsTheTypecallsCallChecksTest::testMisuseReportsEveryClauseAPlainFunctionRejectscallsArrayConstructorTest::testDeriveScalarReportsValuesWithoutACommonTypecallsCaseBranchTest::testRenderWritesWhenAndThencallsCaseExpressionTest::testOutputNameIsTheElseNameOrCasecallsBooleanOperationTest::testDeriveScalarIsBooleancallsBooleanOperationTest::testDeriveScalarReportsANonBooleanOperandcallsBooleanOperationTest::testRejectsADisjunctionInsideAConjunctioncallsBooleanOperationTest::testRenderWritesTheOperatorcallsFunctionCallTest::testDeriveScalarDerivesTheClausescallsFunctionCallTest::testRenderWritesEveryPartInOrdercallsJsonObjectAggregateTest::testDeriveScalarDerivesTheFilterAndTheWindowcallsJsonObjectAggregateTest::testRenderWritesTheClausesFilterAndWindowcallsPositionTest::testRejectsAnOperandThatIsNotRestrictedcallsAtomicBodyTest::testDeriveClauseDerivesEachStatementcallsAtomicBodyTest::testRenderEndsEachStatementWithASemicoloncallsReturnStatementTest::testDeriveClauseDerivesTheValuecallsReturnStatementTest::testRenderWritesReturncalls