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

POSITION (substring IN string): where a substring first occurs.

The server calls pg_catalog.position(string, substring), the operands swapped. Both operands are restricted expressions (b_expr): an operand that would need parentheses there is rejected. Rule: PG-POSITION-001. Facts: those of the call (PG-CALL-RESULT-001; integer). The result column is named position. Source: https://www.postgresql.org/docs/17/functions-string.html. Status: Implemented.

Naming the result columndoctest
$position = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Text\Position(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral(), new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral());
    $position->outputName()->value // => 'position'

Properties§

public Scalar $substring
public Scalar $string

Methods§

public function __construct(public Scalar $substring, public Scalar $string)

Parameters

$substringScalarThe substring searched for
$stringScalarThe string searched
Calls 3
public function outputName(): Name

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

Returns

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

Derives the operands and the result of pg_catalog.position.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes POSITION with the substring and the string.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 4§

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

Dedicated tests 4

Relations§

Instantiated in 1
Type declarations 1