final class Trim
    implements Scalar, OutputNaming
    uses Snapshot
Public API: explicitly declared with @visibility public.

TRIM ([LEADING | TRAILING | BOTH] [characters] FROM strings) and the forms without FROM.

The server calls pg_catalog.btrim, ltrim or rtrim with the strings written and then the characters, if written before FROM. BOTH, and FROM without characters, are the defaults and are not kept. Rule: PG-TRIM-001. Facts: those of the call (PG-CALL-RESULT-001; text, or bytea for byte strings). The result column is named after the function called. Source: https://www.postgresql.org/docs/17/functions-string.html. Status: Implemented.

Reading a trim of the enddoctest
$trim = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Text\Trim(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\Text\TrimSide::Trailing, null, [new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()]);
    $trim->outputName()->value // => 'rtrim'

Properties§

public non-empty-list<Scalar> $strings
public TrimSide $side
public Scalar|null $characters

Methods§

public function __construct(
    public TrimSide $side,
    public Scalar|null $characters,
    list<Scalar> $strings,
)

Parameters

$sideTrimSideThe ends trimmed
$charactersScalar|nullThe characters removed, written before FROM
$stringslist<Scalar>The strings trimmed; at least one
Calls 2
public function outputName(): Name

Names an unaliased result column after the function the server calls.

Returns

Test cases 1
Calls 2
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operands and the result of the trim function.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 4
public function render(Output $out): void

Writes TRIM with the side, the characters and the strings.

Parameters

$outOutput
Test cases 1
Calls 4

Test cases 5§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5

Relations§

Instantiated in 3
Type declarations 1