final class AmbiguousAlias
    implements Resolution, Diagnostic
    uses Snapshot
Public API: explicitly declared with @visibility public.

A name that no column of the position has and that several different select list items carry as their alias; none is chosen.

MySQL reports such a name with ER_NON_UNIQ_ERROR ("Column '%s' in %s is

  • ambiguous"); items that compute the same expression under the same alias

do not make a name ambiguous. Source: https://dev.mysql.com/doc/refman/8.4/en/problems-with-alias.html.

Keeping every select list item an alias namesdoctest
(new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT 1 AS x, 2 AS x ORDER BY x + 1', []) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\SemanticException: Column x is ambiguous.
Refusing a single candidatedoctest
new \SqlSemantics\Platform\MySql\Statement\Name\AmbiguousAlias(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('x'), []) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstruction

Properties§

public list<Field> $candidates
public Name $name

Methods§

public function __construct(public Name $name, list<Field> $candidates)

Parameters

$nameNameThe name used
$candidateslist<Field>The select list items the alias names; at least two
Calls 2
public function message(): string

Describes the problem.

Returns

string
Test cases 1

Test cases 4§

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

Dedicated tests 2
Other tests reaching this symbol 2

Relations§

Instantiated in 1
Type declarations 1