classCreateUserMapping
final class CreateUserMapping
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.A request to define how a user connects to a foreign server.
Rule: PG-USER-MAPPING-001. Mirrors CreateUserMappingStmt. The user is a role specification or the keyword USER, which designates the current user. Source: https://www.postgresql.org/docs/17/sql-createusermapping.html. Status: Implemented.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("CREATE USER MAPPING FOR USER SERVER s OPTIONS (user 'bob')");
[$operation->statement->user, $operation->statement->options[0]->value->value] // => [\SqlSemantics\Platform\PostgreSql\Statement\Catalog\ForeignData\MappingUser::User, 'bob']Properties§
public list<GenericOption> $optionspublic bool $ifNotExistspublic RoleSpec|MappingUser $userpublic Name $serverMethods§
public function __construct(
public bool $ifNotExists,
public RoleSpec|MappingUser $user,
public Name $server,
list<GenericOption> $options = [],
)Parameters
$ifNotExists | bool | Whether IF NOT EXISTS is written |
$user | RoleSpec|MappingUser | The user |
$server | Name | The foreign server |
$options | list<GenericOption> | The options |
Calls 2
- static-call Check::listOf() line 47
- class-const GenericOption::class() line 47
public function deriveStatement(Derivation $derivation): voidDerives nothing: a user mapping is not part of a declaration context.
Parameters
$derivation | Derivation |
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 62
- class-const NameUse::Column() line 66
- method-call ForeignOptions::write() line 67
- new ForeignOptions line 67
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
CreateUserMappingTestcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\ForeignDataRule::statement() packages/sql-semantics-postgres/src/Lowering/Catalog/ForeignDataRule.php:84
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\ForeignDataRule::statement() packages/sql-semantics-postgres/src/Lowering/Catalog/ForeignDataRule.php:85