packages/sql-semantics-mysql/src/Statement/Server/Problem/UnknownHistogramColumn.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\MySql\Statement\Server\Problem;
6
7use SqlSemantics\Platform\MySql\Model\Statement\Fact\Diagnostic;
8use SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name;
9use SqlSemantics\Platform\MySql\Model\Statement\Snapshot;
10
11/**
12 * A column of a histogram request that the declared table does not have.
13 *
14 * The server reports that the column does not exist and builds or drops no
15 * histogram for it.
16 * Source: https://dev.mysql.com/doc/refman/8.4/en/analyze-table.html.
17 *
18 * @visibility public
19 * @example Describing the problem
20 * (new \SqlSemantics\Platform\MySql\Statement\Server\Problem\UnknownHistogramColumn(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('a')))->message() // => "The column 'a' does not exist."
21 */
22final class UnknownHistogramColumn implements Diagnostic
23{
24 use Snapshot;
25
26 /**
27 * @param Name $column The column name as written
28 */
29 public function __construct(public readonly Name $column)
30 {
31 }
32
33 /**
34 * Describes the problem.
35 */
36 public function message(): string
37 {
38 return "The column '" . $this->column->value . "' does not exist.";
39 }
40}
41