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

Reports the problems of a table definition that the server rejects.

Rule: MYSQL-TABLE-PROBLEMS-001. Diagnostics: two columns of the declared table with one name (ER_DUP_FIELDNAME); more than one primary key, counting each column with a PRIMARY KEY attribute and each PRIMARY KEY element (ER_MULTIPLE_PRI_KEY); from MySQL 5.7 on, a primary key column whose NULL attribute is still in force (ER_PRIMARY_CANT_HAVE_NULL; 5.6 makes it NOT NULL silently); a key part or foreign key column that names no column of the table, when its column list is complete (ER_KEY_COLUMN_DOES_NOT_EXITS); a table without columns and without a query (ER_TABLE_MUST_HAVE_COLUMNS); a column name that is not valid, among them the name a selected column gets after its text (ER_WRONG_COLUMN_NAME, MYSQL-COLUMN-NAME-001); a generated column of the CREATE TABLE part that a column of the SELECT part names, so that the query would fill it (ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN; sql/sql_insert.cc Query_result_create::create_table_for_query_block). Terminates: one pass over the elements and the key parts. Source: https://dev.mysql.com/doc/refman/8.4/en/create-table.html, https://dev.mysql.com/doc/mysql-errors/8.4/en/server-error-reference.html. Status: Implemented.

Methods§

public function names(Table $table, Derivation $derivation): void

Reports each column name that is not a valid column name (MYSQL-COLUMN-NAME-001).

Parameters

$tableTable
$derivationDerivation
Called from 1
Calls 5
public function selected(
    CreateTable $definition,
    QueryFact $output,
    Derivation $derivation,
): void

Reports each generated column of the CREATE TABLE part that a column of the SELECT part would fill (MYSQL-GENERATED-WRITE-001).

Parameters

$definitionCreateTable
$outputQueryFact
$derivationDerivation
Called from 1
Calls 4
public function keyColumns(list<object> $parts, Table $table, Derivation $derivation): void

Reports the key parts that name no column of a complete table.

Parameters

$partslist<object>The key parts
$tableTable
$derivationDerivation
Called from 1
Calls 3

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 3