packages/sql-semantics-postgres/src/Statement/Invocation/Problem/JsonProblemKind.php

1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\PostgreSql\Statement\Invocation\Problem;
6
7/**
8 * A mistake in an SQL/JSON expression that the server reports while analyzing the statement.
9 *
10 * Each case carries the server's message, with `%s` for its subjects in order.
11 * Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-SQLJSON-QUERYING,
12 * `transformJsonFuncExpr` and `transformJsonValueExpr` in `src/backend/parser/parse_expr.c` of PostgreSQL 17.
13 *
14 * @visibility public
15 * @example Reading the message of quotes with a wrapper
16 *     \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Problem\JsonProblemKind::QuotesWithWrapper->value // => 'SQL/JSON QUOTES behavior must not be specified when WITH WRAPPER is used'
17 */
18enum JsonProblemKind: string
19{
20    case InvalidBehavior = 'invalid %s behavior';
21    case InvalidColumnBehavior = 'invalid %s behavior for column "%s"';
22    case QuotesWithWrapper = 'SQL/JSON QUOTES behavior must not be specified when WITH WRAPPER is used';
23    case FormatInReturning = 'cannot specify FORMAT JSON in RETURNING clause of %s()';
24    case EncodingWithoutBytea = 'JSON ENCODING clause is only allowed for bytea input type';
25    case SubqueryColumns = 'subquery must return only one column';
26    case ParsedEncodingWithoutBytea = 'cannot use JSON FORMAT ENCODING clause for non-bytea input types';
27}
28