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

SUBSTRING (string SIMILAR pattern ESCAPE escape): the part of a string a SQL regular expression marks.

The server calls pg_catalog.substring(string, pattern, escape). Rule: PG-SIMILAR-SUBSTRING-001. Facts: those of the call (PG-CALL-RESULT-001; text). The result column is named substring. SIMILAR follows the string at the level of the pattern operators, and ESCAPE continues an open pattern match at the end of the pattern, so an operand that would lose its place there is rejected. Source: https://www.postgresql.org/docs/17/functions-matching.html#FUNCTIONS-SIMILARTO-REGEXP. Status: Implemented.

Naming the result columndoctest
$null = static fn () => new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral();
    (new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Text\SimilarSubstring($null(), $null(), $null()))->outputName()->value // => 'substring'

Properties§

public Scalar $string
public Scalar $pattern
public Scalar $escape

Methods§

public function __construct(
    public Scalar $string,
    public Scalar $pattern,
    public Scalar $escape,
)

Parameters

$stringScalarThe string
$patternScalarThe SQL regular expression
$escapeScalarThe escape character
Calls 5
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.substring.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes SUBSTRING with SIMILAR and ESCAPE.

Parameters

$outOutput
Test cases 1
Calls 1

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 1