classPgSqlConflictTarget
final class PgSqlConflictTarget
Public API: explicitly declared with
@visibility public.Structured ON CONFLICT arbiter target.
$target = new \ZtdQuery\Platform\Postgres\Sql\Conflict\PgSqlConflictTarget(true, ['id']);
$target->columns // => ['id']
$target->constraint // => nullProperties§
public bool $specifiedpublic array<int, string> $columns = []public ?string $predicate = nullpublic ?string $constraint = nullMethods§
public function __construct(
public bool $specified,
public array<int, string> $columns = [],
public ?string $predicate = null,
public ?string $constraint = null,
)Parameters
$specified | bool | |
$columns | array<int, string> | |
$predicate | ?string | |
$constraint | ?string |
Throws
InvalidArgumentExceptionCalls 1
- new
InvalidArgumentExceptionline 34
public function resolve(
CandidateKeySet $candidateKeys,
array<string, PartialUniqueIndex> $partialIndexes,
string $sql,
): array{keys: CandidateKeySet, predicate: string|null}Public API: explicitly declared with
@visibility public.Parameters
$candidateKeys | CandidateKeySet | |
$partialIndexes | array<string, PartialUniqueIndex> | |
$sql | string |
Returns
array{keys: CandidateKeySet, predicate: string|null}Throws
$target = new \ZtdQuery\Platform\Postgres\Sql\Conflict\PgSqlConflictTarget(true, ['id']);
$keys = new \ZtdQuery\Schema\Key\CandidateKeySet(['users_pkey' => ['id'], 'users_email_key' => ['email']]);
$resolved = $target->resolve($keys, [], 'INSERT INTO users VALUES (1) ON CONFLICT (id) DO NOTHING');
$resolved['keys']->keys() // => ['users_pkey' => ['id']]
$resolved['predicate'] // => nullTest cases 6
PgSqlConflictTargetTest::testRegularUniqueIndexTakesPrecedenceOverPartialIndexInferencecallsPgSqlConflictTargetTest::testRejectsAmbiguousPartialIndexescallsPgSqlConflictTargetTest::testRejectsPartialIndexWithDifferentColumnAritycallsPgSqlConflictTargetTest::testResolvesNamedConstraintCaseInsensitivelycallsPgSqlConflictTargetTest::testResolvesPartialIndexWithOrderIndependentColumnscallsPgSqlConflictTargetTest::testUnspecifiedTargetKeepsEveryRegularCandidateKeycalls
Calls 6
- method-call CandidateKeySet::keys() line 57
- function-call
strcasecmpline 58 - new CandidateKeySet line 59
- new UnsupportedSqlException line 63
- static-call ColumnSet::normalizedColumns() line 66
- function-call
countline 83
Test cases 26§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
PgSqlConflictTargetTest::testRegularUniqueIndexTakesPrecedenceOverPartialIndexInferencecallsPgSqlConflictTargetTest::testRejectsAmbiguousPartialIndexescallsPgSqlConflictTargetTest::testRejectsPartialIndexWithDifferentColumnAritycallsPgSqlConflictTargetTest::testResolvesNamedConstraintCaseInsensitivelycallsPgSqlConflictTargetTest::testResolvesPartialIndexWithOrderIndependentColumnscallsPgSqlConflictTargetTest::testUnspecifiedTargetKeepsEveryRegularCandidateKeycalls
Other tests reaching this symbol 20
PgSqlSessionFactoryTestcallsTableContextTestcallsPgSqlQueryGuardTestcallsPgSqlRewriterTestcallsStatementRewriterTestcallsDeleteTransformerTestcallsSelectProjectionTestcallsUpsertProjectionTestcallsValueProjectionTestcallsInsertSelectRendererTestcallsInsertTransformerTestcallsPgSqlTransformerTestcallsUpdateTransformerTestcallsRowMutationResolverTestcallsTableMutationResolverTestcallsPgSqlMutationResolverTestcallsPgSqlParserTest::testConflictTargetSkipsNestedAnchorsAndStopsAtTheActionBoundarycallsPgSqlParserTest::testExtractOnConflictTargetExtractsPartialConflictTargetStructurallycallsPgSqlParserTest::testExtractsNamedAndUnspecifiedConflictTargetscallsConflictClauseTest::testExtractOnConflictTargetcalls
Relations§
Instantiated in 3
- new ZtdQuery\Platform\Postgres\Sql\Statement\ConflictClause::extractOnConflictTarget() packages/ztd-query-postgres/src/Sql/Statement/ConflictClause.php:36
- new ZtdQuery\Platform\Postgres\Sql\Statement\ConflictClause::namedConstraint() packages/ztd-query-postgres/src/Sql/Statement/ConflictClause.php:194
- new ZtdQuery\Platform\Postgres\Sql\Statement\ConflictClause::indexTarget() packages/ztd-query-postgres/src/Sql/Statement/ConflictClause.php:246
Type declarations 4
- type ZtdQuery\Platform\Postgres\Sql\PgSqlParser packages/ztd-query-postgres/src/Sql/PgSqlParser.php:107
- type ZtdQuery\Platform\Postgres\Sql\Statement\ConflictClause packages/ztd-query-postgres/src/Sql/Statement/ConflictClause.php:23
- type ZtdQuery\Platform\Postgres\Sql\Statement\ConflictClause packages/ztd-query-postgres/src/Sql/Statement/ConflictClause.php:176
- type ZtdQuery\Platform\Postgres\Sql\Statement\ConflictClause packages/ztd-query-postgres/src/Sql/Statement/ConflictClause.php:224