final class CopyOptions
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.

Checks the options of COPY.

Rule: PG-COPY-OPTIONS-001. Every option of the old syntax, BINARY after COPY and DELIMITERS set a generic option (format, freeze, delimiter, null, header, quote, escape, encoding, force_quote, force_not_null, force_null). A parenthesized option must be one PostgreSQL knows: those, default and convert_selectively, and from PostgreSQL 17 on_error and log_verbosity; the names compare exactly, as written after folding. An option set twice, by any spelling, is reported. A column a FORCE option names, in the old syntax or as the list argument of force_quote, force_not_null or force_null, that is a generated column is reported (column "b" is a generated column, CopyGetAttnums, copy.c); a column a FORCE option of the old syntax names that is not copied is reported when the copied columns are known. Termination: one pass over the options. Source: https://www.postgresql.org/docs/17/sql-copy.html, https://www.postgresql.org/docs/16/sql-copy.html. Status: Implemented.

Methods§

public function check(
    bool $binary,
    bool $delimiters,
    list<CopyFlag|CopyText|CopyForce> $legacy,
    list<CopyOption> $options,
    list<Name>|null $copied,
    Derivation $derivation,
    list<Name> $generated = [],
): void

Checks the options of a COPY statement.

Parameters

$binarybool
$delimitersbool
$legacylist<CopyFlag|CopyText|CopyForce>
$optionslist<CopyOption>
$copiedlist<Name>|nullThe columns copied, or null when they are not known
$derivationDerivation
$generatedlist<Name>The generated columns of the table
Called from 2
Calls 12
public function listed(CopyOption $option): list<Name>

Answers the column names the list argument of an option holds, or none when its argument is not a list.

Parameters

$optionCopyOption

Returns

list<Name>
Test cases 1
Called from 1
Calls 1
public function copied(
    string $option,
    list<Name> $columns,
    list<Name>|null $copied,
    list<Name> $generated,
    Derivation $derivation,
): void

Reports the columns of a FORCE option that are generated columns or, when the copied columns are known, are not copied.

Parameters

$optionstringThe option name as the server spells it in its messages
$columnslist<Name>The columns the option names
$copiedlist<Name>|nullThe columns copied, or null when they are not known
$generatedlist<Name>The generated columns of the table
$derivationDerivation
Called from 2
Calls 5

Private surface 2§

Implementation details, listed for orientation only.

private const KNOWN = ['format', 'freeze', 'delimiter', 'null', 'default', 'header', 'quote', 'escape…
private const ADDED = ['on_error', 'log_verbosity']

Test cases 1§

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

Dedicated tests 1

Relations§

Instantiated in 2
Method calls 2