1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-10 14:22:35 +03:00

Improve error messages of input functions for pg_dependencies and pg_ndistinct

The error details updated in this commit can be reached in the
regression tests.  They did not follow the project style, and they
should be written them as full sentences.

Some of the errors are switched to use an elog(), for cases that involve
paths that cannot be reached based on the previous state of the parser
processing the input data (array start, object end, etc.).  The error
messages for these cases use now a more consistent style across the
board, with the state of the parser reported for debugging.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Michael Paquier <michael@paquier.xyz>
Co-authored-by: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/1353179.1764901790@sss.pgh.pa.us
This commit is contained in:
Michael Paquier
2025-12-08 10:23:48 +09:00
parent 4eda42e8bd
commit f68597ee77
4 changed files with 227 additions and 241 deletions

View File

@@ -85,7 +85,7 @@ dependencies_object_start(void *state)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Expected an object key."));
errdetail("A key was expected."));
break;
case DEPS_EXPECT_ATTNUM_LIST:
@@ -124,10 +124,9 @@ dependencies_object_start(void *state)
break;
default:
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Unexpected parse state: %d", (int) parse->state));
elog(ERROR,
"object start of \"%s\" found in unexpected parse state: %d.",
"pg_dependencies", (int) parse->state);
break;
}
@@ -149,20 +148,16 @@ dependencies_object_end(void *state)
int natts = 0;
if (parse->state != DEPS_EXPECT_KEY)
{
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Unexpected parse state: %d", (int) parse->state));
return JSON_SEM_ACTION_FAILED;
}
elog(ERROR,
"object end of \"%s\" found in unexpected parse state: %d.",
"pg_dependencies", (int) parse->state);
if (!parse->found_attributes)
{
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Item must contain \"%s\" key",
errdetail("Item must contain \"%s\" key.",
PG_DEPENDENCIES_KEY_ATTRIBUTES));
return JSON_SEM_ACTION_FAILED;
}
@@ -226,7 +221,7 @@ dependencies_object_end(void *state)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Item \"%s\" value %d found in the \"%s\" list.",
errdetail("Item \"%s\" with value %d has been found in the \"%s\" list.",
PG_DEPENDENCIES_KEY_DEPENDENCY, parse->dependency,
PG_DEPENDENCIES_KEY_ATTRIBUTES));
return JSON_SEM_ACTION_FAILED;
@@ -274,7 +269,7 @@ dependencies_array_start(void *state)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Array found in unexpected place."));
errdetail("Array has been found at an unexpected location."));
return JSON_SEM_ACTION_FAILED;
}
@@ -326,10 +321,9 @@ dependencies_array_end(void *state)
* This can only happen if a case was missed in
* dependencies_array_start().
*/
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Array found in unexpected place."));
elog(ERROR,
"array end of \"%s\" found in unexpected parse state: %d.",
"pg_dependencies", (int) parse->state);
break;
}
return JSON_SEM_ACTION_FAILED;
@@ -443,10 +437,9 @@ dependencies_array_element_start(void *state, bool isnull)
break;
default:
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Unexpected array element."));
elog(ERROR,
"array element start of \"%s\" found in unexpected parse state: %d.",
"pg_dependencies", (int) parse->state);
break;
}
@@ -499,7 +492,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Invalid \"%s\" value.", PG_DEPENDENCIES_KEY_ATTRIBUTES));
errdetail("Key \"%s\" has an incorrect value.", PG_DEPENDENCIES_KEY_ATTRIBUTES));
return JSON_SEM_ACTION_FAILED;
}
@@ -512,7 +505,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Invalid \"%s\" element: %d.",
errdetail("Invalid \"%s\" element has been found: %d.",
PG_DEPENDENCIES_KEY_ATTRIBUTES, attnum));
return JSON_SEM_ACTION_FAILED;
}
@@ -526,7 +519,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Invalid \"%s\" element: %d cannot follow %d.",
errdetail("Invalid \"%s\" element has been found: %d cannot follow %d.",
PG_DEPENDENCIES_KEY_ATTRIBUTES, attnum, prev));
return JSON_SEM_ACTION_FAILED;
}
@@ -544,7 +537,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Invalid \"%s\" value.", PG_DEPENDENCIES_KEY_DEPENDENCY));
errdetail("Key \"%s\" has an incorrect value.", PG_DEPENDENCIES_KEY_DEPENDENCY));
return JSON_SEM_ACTION_FAILED;
}
@@ -557,7 +550,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Invalid \"%s\" value: %d.",
errdetail("Key \"%s\" has an incorrect value: %d.",
PG_DEPENDENCIES_KEY_DEPENDENCY, parse->dependency));
return JSON_SEM_ACTION_FAILED;
}
@@ -574,7 +567,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Invalid \"%s\" value.", PG_DEPENDENCIES_KEY_DEGREE));
errdetail("Key \"%s\" has an incorrect value.", PG_DEPENDENCIES_KEY_DEGREE));
return JSON_SEM_ACTION_FAILED;
}
@@ -585,7 +578,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", parse->str),
errdetail("Unexpected scalar."));
errdetail("Unexpected scalar has been found."));
break;
}
@@ -686,7 +679,7 @@ build_mvdependencies(DependenciesParseState *parse, char *str)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", str),
errdetail("Unexpected end state %d.", parse->state));
errdetail("Unexpected end state has been found: %d.", parse->state));
return NULL;
}
@@ -721,7 +714,7 @@ build_mvdependencies(DependenciesParseState *parse, char *str)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", str),
errdetail("Duplicate \"%s\" array: [%s] with \"%s\": %d.",
errdetail("Duplicated \"%s\" array has been found: [%s] for key \"%s\" and value %d.",
PG_DEPENDENCIES_KEY_ATTRIBUTES, attnum_list,
PG_DEPENDENCIES_KEY_DEPENDENCY, attnum_dep));
pfree(mvdeps);
@@ -808,7 +801,7 @@ pg_dependencies_in(PG_FUNCTION_ARGS)
errsave(parse_state.escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_dependencies: \"%s\"", str),
errdetail("Must be valid JSON."));
errdetail("Input data must be valid JSON."));
PG_RETURN_NULL();
}

View File

@@ -81,7 +81,7 @@ ndistinct_object_start(void *state)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Expected an object key."));
errdetail("A key was expected."));
break;
case NDIST_EXPECT_ATTNUM_LIST:
@@ -111,10 +111,9 @@ ndistinct_object_start(void *state)
break;
default:
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Unexpected parse state: %d", (int) parse->state));
elog(ERROR,
"object start of \"%s\" found in unexpected parse state: %d.",
"pg_ndistinct", (int) parse->state);
break;
}
@@ -136,13 +135,9 @@ ndistinct_object_end(void *state)
MVNDistinctItem *item;
if (parse->state != NDIST_EXPECT_KEY)
{
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Unexpected parse state: %d", (int) parse->state));
return JSON_SEM_ACTION_FAILED;
}
elog(ERROR,
"object end of \"%s\" found in unexpected parse state: %d.",
"pg_ndistinct", (int) parse->state);
if (!parse->found_attributes)
{
@@ -228,7 +223,7 @@ ndistinct_array_start(void *state)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Array found in unexpected place."));
errdetail("Array has been found at an unexpected location."));
return JSON_SEM_ACTION_FAILED;
}
@@ -286,10 +281,9 @@ ndistinct_array_end(void *state)
* This can only happen if a case was missed in
* ndistinct_array_start().
*/
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Array found in unexpected place."));
elog(ERROR,
"array end of \"%s\" found in unexpected parse state: %d.",
"pg_ndistinct", (int) parse->state);
break;
}
@@ -384,10 +378,9 @@ ndistinct_array_element_start(void *state, bool isnull)
break;
default:
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Unexpected array element."));
elog(ERROR,
"array element start of \"%s\" found in unexpected parse state: %d.",
"pg_ndistinct", (int) parse->state);
break;
}
@@ -440,7 +433,7 @@ ndistinct_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Invalid \"%s\" value.", PG_NDISTINCT_KEY_ATTRIBUTES));
errdetail("Key \"%s\" has an incorrect value.", PG_NDISTINCT_KEY_ATTRIBUTES));
return JSON_SEM_ACTION_FAILED;
}
@@ -453,7 +446,7 @@ ndistinct_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Invalid \"%s\" element: %d.",
errdetail("Invalid \"%s\" element has been found: %d.",
PG_NDISTINCT_KEY_ATTRIBUTES, attnum));
return JSON_SEM_ACTION_FAILED;
}
@@ -467,7 +460,7 @@ ndistinct_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Invalid \"%s\" element: %d cannot follow %d.",
errdetail("Invalid \"%s\" element has been found: %d cannot follow %d.",
PG_NDISTINCT_KEY_ATTRIBUTES, attnum, prev));
return JSON_SEM_ACTION_FAILED;
}
@@ -494,7 +487,7 @@ ndistinct_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Invalid \"%s\" value.",
errdetail("Key \"%s\" has an incorrect value.",
PG_NDISTINCT_KEY_NDISTINCT));
break;
@@ -502,7 +495,7 @@ ndistinct_scalar(void *state, char *token, JsonTokenType tokentype)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", parse->str),
errdetail("Unexpected scalar."));
errdetail("Unexpected scalar has been found."));
break;
}
@@ -627,7 +620,7 @@ build_mvndistinct(NDistinctParseState *parse, char *str)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", str),
errdetail("Unexpected end state %d.", parse->state));
errdetail("Unexpected end state has been found: %d.", parse->state));
return NULL;
}
@@ -655,7 +648,7 @@ build_mvndistinct(NDistinctParseState *parse, char *str)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", str),
errdetail("Duplicated \"%s\" array found: [%s]",
errdetail("Duplicated \"%s\" array has been found: [%s].",
PG_NDISTINCT_KEY_ATTRIBUTES, s));
pfree(s);
return NULL;
@@ -705,7 +698,7 @@ build_mvndistinct(NDistinctParseState *parse, char *str)
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", str),
errdetail("\"%s\" array: [%s] must be a subset of array: [%s]",
errdetail("\"%s\" array [%s] must be a subset of array [%s].",
PG_NDISTINCT_KEY_ATTRIBUTES,
item_list, refitem_list));
pfree(item_list);
@@ -784,7 +777,7 @@ pg_ndistinct_in(PG_FUNCTION_ARGS)
errsave(parse_state.escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed pg_ndistinct: \"%s\"", str),
errdetail("Must be valid JSON."));
errdetail("Input data must be valid JSON."));
PG_RETURN_NULL();
}

View File

@@ -4,7 +4,7 @@ SELECT 'null'::pg_dependencies;
ERROR: malformed pg_dependencies: "null"
LINE 1: SELECT 'null'::pg_dependencies;
^
DETAIL: Unexpected scalar.
DETAIL: Unexpected scalar has been found.
SELECT '{"a": 1}'::pg_dependencies;
ERROR: malformed pg_dependencies: "{"a": 1}"
LINE 1: SELECT '{"a": 1}'::pg_dependencies;
@@ -26,9 +26,9 @@ LINE 1: SELECT '[null]'::pg_dependencies;
^
DETAIL: Item list elements cannot be null.
SELECT * FROM pg_input_error_info('null', 'pg_dependencies');
message | detail | hint | sql_error_code
-----------------------------------+--------------------+------+----------------
malformed pg_dependencies: "null" | Unexpected scalar. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------+-----------------------------------+------+----------------
malformed pg_dependencies: "null" | Unexpected scalar has been found. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('{"a": 1}', 'pg_dependencies');
@@ -129,44 +129,44 @@ SELECT '[{"attributes" : ["\ud83d",3], "dependency" : 4, "degree": 0.250}]'::pg_
ERROR: malformed pg_dependencies: "[{"attributes" : ["\ud83d",3], "dependency" : 4, "degree": 0.250}]"
LINE 1: SELECT '[{"attributes" : ["\ud83d",3], "dependency" : 4, "de...
^
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
SELECT '[{"attributes" : [2,3], "dependency" : "\ud83d", "degree": 0.250}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : "\ud83d", "degree": 0.250}]"
LINE 1: SELECT '[{"attributes" : [2,3], "dependency" : "\ud83d", "de...
^
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
SELECT '[{"attributes" : [2,3], "dependency" : 4, "degree": "\ud83d"}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : 4, "degree": "\ud83d"}]"
LINE 1: SELECT '[{"attributes" : [2,3], "dependency" : 4, "degree": ...
^
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
SELECT '[{"\ud83d" : [2,3], "dependency" : 4, "degree": 0.250}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"\ud83d" : [2,3], "dependency" : 4, "degree": 0.250}]"
LINE 1: SELECT '[{"\ud83d" : [2,3], "dependency" : 4, "degree": 0.25...
^
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
SELECT * FROM pg_input_error_info('[{"attributes" : ["\ud83d",3], "dependency" : 4, "degree": 0.250}]', 'pg_dependencies');
message | detail | hint | sql_error_code
-------------------------------------------------------------------------------------------------+---------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : ["\ud83d",3], "dependency" : 4, "degree": 0.250}]" | Must be valid JSON. | | 22P02
message | detail | hint | sql_error_code
-------------------------------------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : ["\ud83d",3], "dependency" : 4, "degree": 0.250}]" | Input data must be valid JSON. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "dependency" : "\ud83d", "degree": 0.250}]', 'pg_dependencies');
message | detail | hint | sql_error_code
-------------------------------------------------------------------------------------------------+---------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : "\ud83d", "degree": 0.250}]" | Must be valid JSON. | | 22P02
message | detail | hint | sql_error_code
-------------------------------------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : "\ud83d", "degree": 0.250}]" | Input data must be valid JSON. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "dependency" : 4, "degree": "\ud83d"}]', 'pg_dependencies');
message | detail | hint | sql_error_code
---------------------------------------------------------------------------------------------+---------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : 4, "degree": "\ud83d"}]" | Must be valid JSON. | | 22P02
message | detail | hint | sql_error_code
---------------------------------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : 4, "degree": "\ud83d"}]" | Input data must be valid JSON. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"\ud83d" : [2,3], "dependency" : 4, "degree": 0.250}]', 'pg_dependencies');
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------+---------------------+------+----------------
malformed pg_dependencies: "[{"\ud83d" : [2,3], "dependency" : 4, "degree": 0.250}]" | Must be valid JSON. | | 22P02
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_dependencies: "[{"\ud83d" : [2,3], "dependency" : 4, "degree": 0.250}]" | Input data must be valid JSON. | | 22P02
(1 row)
-- Valid keys, invalid values
@@ -174,7 +174,7 @@ SELECT '[{"attributes" : null, "dependency" : 4, "degree": 1.000}]'::pg_dependen
ERROR: malformed pg_dependencies: "[{"attributes" : null, "dependency" : 4, "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : null, "dependency" : 4, "degree": 1...
^
DETAIL: Unexpected scalar.
DETAIL: Unexpected scalar has been found.
SELECT '[{"attributes" : [2,null], "dependency" : 4, "degree": 1.000}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,null], "dependency" : 4, "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : [2,null], "dependency" : 4, "degree...
@@ -184,51 +184,51 @@ SELECT '[{"attributes" : [2,3], "dependency" : null, "degree": 1.000}]'::pg_depe
ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : null, "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : [2,3], "dependency" : null, "degree...
^
DETAIL: Invalid "dependency" value.
DETAIL: Key "dependency" has an incorrect value.
SELECT '[{"attributes" : [2,"a"], "dependency" : 4, "degree": 1.000}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,"a"], "dependency" : 4, "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : [2,"a"], "dependency" : 4, "degree"...
^
DETAIL: Invalid "attributes" value.
DETAIL: Key "attributes" has an incorrect value.
SELECT '[{"attributes" : [2,3], "dependency" : "a", "degree": 1.000}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : "a", "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : [2,3], "dependency" : "a", "degree"...
^
DETAIL: Invalid "dependency" value.
DETAIL: Key "dependency" has an incorrect value.
SELECT '[{"attributes" : [2,3], "dependency" : [], "degree": 1.000}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : [], "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : [2,3], "dependency" : [], "degree":...
^
DETAIL: Array found in unexpected place.
DETAIL: Array has been found at an unexpected location.
SELECT '[{"attributes" : [2,3], "dependency" : [null], "degree": 1.000}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : [null], "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : [2,3], "dependency" : [null], "degr...
^
DETAIL: Array found in unexpected place.
DETAIL: Array has been found at an unexpected location.
SELECT '[{"attributes" : [2,3], "dependency" : [1,null], "degree": 1.000}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : [1,null], "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : [2,3], "dependency" : [1,null], "de...
^
DETAIL: Array found in unexpected place.
DETAIL: Array has been found at an unexpected location.
SELECT '[{"attributes" : 1, "dependency" : 4, "degree": 1.000}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : 1, "dependency" : 4, "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : 1, "dependency" : 4, "degree": 1.00...
^
DETAIL: Unexpected scalar.
DETAIL: Unexpected scalar has been found.
SELECT '[{"attributes" : "a", "dependency" : 4, "degree": 1.000}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : "a", "dependency" : 4, "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : "a", "dependency" : 4, "degree": 1....
^
DETAIL: Unexpected scalar.
DETAIL: Unexpected scalar has been found.
SELECT '[{"attributes" : [2,3], "dependency" : 4, "degree": NaN}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : 4, "degree": NaN}]"
LINE 1: SELECT '[{"attributes" : [2,3], "dependency" : 4, "degree": ...
^
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
SELECT * FROM pg_input_error_info('[{"attributes" : null, "dependency" : 4, "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------------------+--------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : null, "dependency" : 4, "degree": 1.000}]" | Unexpected scalar. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------------------+-----------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : null, "dependency" : 4, "degree": 1.000}]" | Unexpected scalar has been found. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,null], "dependency" : 4, "degree": 1.000}]', 'pg_dependencies');
@@ -238,57 +238,57 @@ SELECT * FROM pg_input_error_info('[{"attributes" : [2,null], "dependency" : 4,
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "dependency" : null, "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
---------------------------------------------------------------------------------------------+-----------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : null, "degree": 1.000}]" | Invalid "dependency" value. | | 22P02
message | detail | hint | sql_error_code
---------------------------------------------------------------------------------------------+------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : null, "degree": 1.000}]" | Key "dependency" has an incorrect value. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,"a"], "dependency" : 4, "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------------+-----------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,"a"], "dependency" : 4, "degree": 1.000}]" | Invalid "attributes" value. | | 22P02
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------------+------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,"a"], "dependency" : 4, "degree": 1.000}]" | Key "attributes" has an incorrect value. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "dependency" : "a", "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------------+-----------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : "a", "degree": 1.000}]" | Invalid "dependency" value. | | 22P02
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------------+------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : "a", "degree": 1.000}]" | Key "dependency" has an incorrect value. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "dependency" : [], "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
-------------------------------------------------------------------------------------------+----------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : [], "degree": 1.000}]" | Array found in unexpected place. | | 22P02
message | detail | hint | sql_error_code
-------------------------------------------------------------------------------------------+-------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : [], "degree": 1.000}]" | Array has been found at an unexpected location. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "dependency" : [null], "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------------------------+----------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : [null], "degree": 1.000}]" | Array found in unexpected place. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------------------------+-------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : [null], "degree": 1.000}]" | Array has been found at an unexpected location. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "dependency" : [1,null], "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
-------------------------------------------------------------------------------------------------+----------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : [1,null], "degree": 1.000}]" | Array found in unexpected place. | | 22P02
message | detail | hint | sql_error_code
-------------------------------------------------------------------------------------------------+-------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : [1,null], "degree": 1.000}]" | Array has been found at an unexpected location. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : 1, "dependency" : 4, "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------+--------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : 1, "dependency" : 4, "degree": 1.000}]" | Unexpected scalar. | | 22P02
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------+-----------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : 1, "dependency" : 4, "degree": 1.000}]" | Unexpected scalar has been found. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : "a", "dependency" : 4, "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
----------------------------------------------------------------------------------------+--------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : "a", "dependency" : 4, "degree": 1.000}]" | Unexpected scalar. | | 22P02
message | detail | hint | sql_error_code
----------------------------------------------------------------------------------------+-----------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : "a", "dependency" : 4, "degree": 1.000}]" | Unexpected scalar has been found. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "dependency" : 4, "degree": NaN}]', 'pg_dependencies');
message | detail | hint | sql_error_code
----------------------------------------------------------------------------------------+---------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : 4, "degree": NaN}]" | Must be valid JSON. | | 22P02
message | detail | hint | sql_error_code
----------------------------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : 4, "degree": NaN}]" | Input data must be valid JSON. | | 22P02
(1 row)
SELECT '[{"attributes": [], "dependency": 2, "degree": 1}]' ::pg_dependencies;
@@ -317,22 +317,22 @@ SELECT '[{"dependency" : 4, "degree": "1.2"}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"dependency" : 4, "degree": "1.2"}]"
LINE 1: SELECT '[{"dependency" : 4, "degree": "1.2"}]'::pg_dependenc...
^
DETAIL: Item must contain "attributes" key
DETAIL: Item must contain "attributes" key.
SELECT '[{"attributes" : [1,2,3,4,5,6,7], "dependency" : 0, "degree": "1.2"}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [1,2,3,4,5,6,7], "dependency" : 0, "degree": "1.2"}]"
LINE 1: SELECT '[{"attributes" : [1,2,3,4,5,6,7], "dependency" : 0, ...
^
DETAIL: Invalid "dependency" value: 0.
DETAIL: Key "dependency" has an incorrect value: 0.
SELECT '[{"attributes" : [1,2,3,4,5,6,7], "dependency" : -9, "degree": "1.2"}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [1,2,3,4,5,6,7], "dependency" : -9, "degree": "1.2"}]"
LINE 1: SELECT '[{"attributes" : [1,2,3,4,5,6,7], "dependency" : -9,...
^
DETAIL: Invalid "dependency" value: -9.
DETAIL: Key "dependency" has an incorrect value: -9.
SELECT '[{"attributes": [1,2], "dependency": 2, "degree": 1}]' ::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes": [1,2], "dependency": 2, "degree": 1}]"
LINE 1: SELECT '[{"attributes": [1,2], "dependency": 2, "degree": 1}...
^
DETAIL: Item "dependency" value 2 found in the "attributes" list.
DETAIL: Item "dependency" with value 2 has been found in the "attributes" list.
SELECT '[{"attributes" : [1, {}], "dependency" : 1, "degree": "1.2"}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [1, {}], "dependency" : 1, "degree": "1.2"}]"
LINE 1: SELECT '[{"attributes" : [1, {}], "dependency" : 1, "degree"...
@@ -352,29 +352,29 @@ SELECT '[{"attributes" : [1,2], "dependency" : 1, "degree": "a"}]'::pg_dependenc
ERROR: malformed pg_dependencies: "[{"attributes" : [1,2], "dependency" : 1, "degree": "a"}]"
LINE 1: SELECT '[{"attributes" : [1,2], "dependency" : 1, "degree": ...
^
DETAIL: Invalid "degree" value.
DETAIL: Key "degree" has an incorrect value.
SELECT * FROM pg_input_error_info('[{"dependency" : 4, "degree": "1.2"}]', 'pg_dependencies');
message | detail | hint | sql_error_code
--------------------------------------------------------------------+------------------------------------+------+----------------
malformed pg_dependencies: "[{"dependency" : 4, "degree": "1.2"}]" | Item must contain "attributes" key | | 22P02
message | detail | hint | sql_error_code
--------------------------------------------------------------------+-------------------------------------+------+----------------
malformed pg_dependencies: "[{"dependency" : 4, "degree": "1.2"}]" | Item must contain "attributes" key. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [1,2,3,4,5,6,7], "dependency" : 0, "degree": "1.2"}]', 'pg_dependencies');
message | detail | hint | sql_error_code
----------------------------------------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [1,2,3,4,5,6,7], "dependency" : 0, "degree": "1.2"}]" | Invalid "dependency" value: 0. | | 22P02
message | detail | hint | sql_error_code
----------------------------------------------------------------------------------------------------+---------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [1,2,3,4,5,6,7], "dependency" : 0, "degree": "1.2"}]" | Key "dependency" has an incorrect value: 0. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [1,2,3,4,5,6,7], "dependency" : -9, "degree": "1.2"}]', 'pg_dependencies');
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------------------------------+---------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [1,2,3,4,5,6,7], "dependency" : -9, "degree": "1.2"}]" | Invalid "dependency" value: -9. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------------------------------+----------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [1,2,3,4,5,6,7], "dependency" : -9, "degree": "1.2"}]" | Key "dependency" has an incorrect value: -9. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes": [1,2], "dependency": 2, "degree": 1}]' , 'pg_dependencies');
message | detail | hint | sql_error_code
------------------------------------------------------------------------------------+-----------------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes": [1,2], "dependency": 2, "degree": 1}]" | Item "dependency" value 2 found in the "attributes" list. | | 22P02
message | detail | hint | sql_error_code
------------------------------------------------------------------------------------+-------------------------------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes": [1,2], "dependency": 2, "degree": 1}]" | Item "dependency" with value 2 has been found in the "attributes" list. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [1, {}], "dependency" : 1, "degree": "1.2"}]', 'pg_dependencies');
@@ -396,9 +396,9 @@ SELECT * FROM pg_input_error_info('[{"attributes" : [1,2], "dependency" : 3, "de
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [1,2], "dependency" : 1, "degree": "a"}]', 'pg_dependencies');
message | detail | hint | sql_error_code
----------------------------------------------------------------------------------------+-------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [1,2], "dependency" : 1, "degree": "a"}]" | Invalid "degree" value. | | 22P02
message | detail | hint | sql_error_code
----------------------------------------------------------------------------------------+--------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [1,2], "dependency" : 1, "degree": "a"}]" | Key "degree" has an incorrect value. | | 22P02
(1 row)
-- Funky degree values, which do not fail.
@@ -422,7 +422,7 @@ SELECT '[{"attributes" : [2], "dependency" : 4, "degree": "inf"}]'::pg_dependenc
SELECT '[{"attributes" : [2], "dependency" : 4, "degree": "-inf"}]'::pg_dependencies::text::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes": [2], "dependency": 4, "degree": -Infinity}]"
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
-- Duplicated keys
SELECT '[{"attributes" : [2,3], "attributes": [1,2], "dependency" : 4, "degree": 1.000}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "attributes": [1,2], "dependency" : 4, "degree": 1.000}]"
@@ -462,22 +462,22 @@ SELECT '[{"attributes" : [0,2], "dependency" : 4, "degree": 0.500}]'::pg_depende
ERROR: malformed pg_dependencies: "[{"attributes" : [0,2], "dependency" : 4, "degree": 0.500}]"
LINE 1: SELECT '[{"attributes" : [0,2], "dependency" : 4, "degree": ...
^
DETAIL: Invalid "attributes" element: 0.
DETAIL: Invalid "attributes" element has been found: 0.
SELECT '[{"attributes" : [-7,-9], "dependency" : 4, "degree": 0.500}]'::pg_dependencies;
ERROR: malformed pg_dependencies: "[{"attributes" : [-7,-9], "dependency" : 4, "degree": 0.500}]"
LINE 1: SELECT '[{"attributes" : [-7,-9], "dependency" : 4, "degree"...
^
DETAIL: Invalid "attributes" element: -9.
DETAIL: Invalid "attributes" element has been found: -9.
SELECT * FROM pg_input_error_info('[{"attributes" : [0,2], "dependency" : 4, "degree": 0.500}]', 'pg_dependencies');
message | detail | hint | sql_error_code
------------------------------------------------------------------------------------------+----------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [0,2], "dependency" : 4, "degree": 0.500}]" | Invalid "attributes" element: 0. | | 22P02
message | detail | hint | sql_error_code
------------------------------------------------------------------------------------------+-------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [0,2], "dependency" : 4, "degree": 0.500}]" | Invalid "attributes" element has been found: 0. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [-7,-9], "dependency" : 4, "degree": 0.500}]', 'pg_dependencies');
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------------+-----------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [-7,-9], "dependency" : 4, "degree": 0.500}]" | Invalid "attributes" element: -9. | | 22P02
message | detail | hint | sql_error_code
--------------------------------------------------------------------------------------------+--------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [-7,-9], "dependency" : 4, "degree": 0.500}]" | Invalid "attributes" element has been found: -9. | | 22P02
(1 row)
-- Duplicated attributes
@@ -485,11 +485,11 @@ SELECT '[{"attributes" : [2,2], "dependency" : 4, "degree": 0.500}]'::pg_depende
ERROR: malformed pg_dependencies: "[{"attributes" : [2,2], "dependency" : 4, "degree": 0.500}]"
LINE 1: SELECT '[{"attributes" : [2,2], "dependency" : 4, "degree": ...
^
DETAIL: Invalid "attributes" element: 2 cannot follow 2.
DETAIL: Invalid "attributes" element has been found: 2 cannot follow 2.
SELECT * FROM pg_input_error_info('[{"attributes" : [2,2], "dependency" : 4, "degree": 0.500}]', 'pg_dependencies');
message | detail | hint | sql_error_code
------------------------------------------------------------------------------------------+--------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,2], "dependency" : 4, "degree": 0.500}]" | Invalid "attributes" element: 2 cannot follow 2. | | 22P02
message | detail | hint | sql_error_code
------------------------------------------------------------------------------------------+-----------------------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,2], "dependency" : 4, "degree": 0.500}]" | Invalid "attributes" element has been found: 2 cannot follow 2. | | 22P02
(1 row)
-- Duplicated attribute lists.
@@ -499,13 +499,13 @@ ERROR: malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : 4, "d
{"attributes" : [2,3], "dependency" : 4, "degree": 1.000}]"
LINE 1: SELECT '[{"attributes" : [2,3], "dependency" : 4, "degree": ...
^
DETAIL: Duplicate "attributes" array: [2, 3] with "dependency": 4.
DETAIL: Duplicated "attributes" array has been found: [2, 3] for key "dependency" and value 4.
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "dependency" : 4, "degree": 1.000},
{"attributes" : [2,3], "dependency" : 4, "degree": 1.000}]', 'pg_dependencies');
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------------------+------------------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : 4, "degree": 1.000},+| Duplicate "attributes" array: [2, 3] with "dependency": 4. | | 22P02
{"attributes" : [2,3], "dependency" : 4, "degree": 1.000}]" | | |
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+------+----------------
malformed pg_dependencies: "[{"attributes" : [2,3], "dependency" : 4, "degree": 1.000},+| Duplicated "attributes" array has been found: [2, 3] for key "dependency" and value 4. | | 22P02
{"attributes" : [2,3], "dependency" : 4, "degree": 1.000}]" | | |
(1 row)
-- Valid inputs

View File

@@ -4,7 +4,7 @@ SELECT 'null'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "null"
LINE 1: SELECT 'null'::pg_ndistinct;
^
DETAIL: Unexpected scalar.
DETAIL: Unexpected scalar has been found.
SELECT '{"a": 1}'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "{"a": 1}"
LINE 1: SELECT '{"a": 1}'::pg_ndistinct;
@@ -26,9 +26,9 @@ LINE 1: SELECT '[null]'::pg_ndistinct;
^
DETAIL: Item list elements cannot be null.
SELECT * FROM pg_input_error_info('null', 'pg_ndistinct');
message | detail | hint | sql_error_code
--------------------------------+--------------------+------+----------------
malformed pg_ndistinct: "null" | Unexpected scalar. | | 22P02
message | detail | hint | sql_error_code
--------------------------------+-----------------------------------+------+----------------
malformed pg_ndistinct: "null" | Unexpected scalar has been found. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('{"a": 1}', 'pg_ndistinct');
@@ -140,44 +140,44 @@ SELECT '[{"\ud83d" : [1, 2], "ndistinct" : 4}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"\ud83d" : [1, 2], "ndistinct" : 4}]"
LINE 1: SELECT '[{"\ud83d" : [1, 2], "ndistinct" : 4}]'::pg_ndistinc...
^
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
SELECT '[{"attributes" : [1, 2], "\ud83d" : 4}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [1, 2], "\ud83d" : 4}]"
LINE 1: SELECT '[{"attributes" : [1, 2], "\ud83d" : 4}]'::pg_ndistin...
^
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
SELECT '[{"attributes" : [1, 2], "ndistinct" : "\ud83d"}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [1, 2], "ndistinct" : "\ud83d"}]"
LINE 1: SELECT '[{"attributes" : [1, 2], "ndistinct" : "\ud83d"}]'::...
^
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
SELECT '[{"attributes" : ["\ud83d", 2], "ndistinct" : 1}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : ["\ud83d", 2], "ndistinct" : 1}]"
LINE 1: SELECT '[{"attributes" : ["\ud83d", 2], "ndistinct" : 1}]'::...
^
DETAIL: Must be valid JSON.
DETAIL: Input data must be valid JSON.
SELECT * FROM pg_input_error_info('[{"\ud83d" : [1, 2], "ndistinct" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
------------------------------------------------------------------+---------------------+------+----------------
malformed pg_ndistinct: "[{"\ud83d" : [1, 2], "ndistinct" : 4}]" | Must be valid JSON. | | 22P02
message | detail | hint | sql_error_code
------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_ndistinct: "[{"\ud83d" : [1, 2], "ndistinct" : 4}]" | Input data must be valid JSON. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [1, 2], "\ud83d" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
-------------------------------------------------------------------+---------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [1, 2], "\ud83d" : 4}]" | Must be valid JSON. | | 22P02
message | detail | hint | sql_error_code
-------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [1, 2], "\ud83d" : 4}]" | Input data must be valid JSON. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [1, 2], "ndistinct" : "\ud83d"}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------+---------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [1, 2], "ndistinct" : "\ud83d"}]" | Must be valid JSON. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [1, 2], "ndistinct" : "\ud83d"}]" | Input data must be valid JSON. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : ["\ud83d", 2], "ndistinct" : 1}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------+---------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : ["\ud83d", 2], "ndistinct" : 1}]" | Must be valid JSON. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------------------+--------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : ["\ud83d", 2], "ndistinct" : 1}]" | Input data must be valid JSON. | | 22P02
(1 row)
-- Valid keys, invalid values
@@ -185,7 +185,7 @@ SELECT '[{"attributes" : null, "ndistinct" : 4}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : null, "ndistinct" : 4}]"
LINE 1: SELECT '[{"attributes" : null, "ndistinct" : 4}]'::pg_ndisti...
^
DETAIL: Unexpected scalar.
DETAIL: Unexpected scalar has been found.
SELECT '[{"attributes" : [], "ndistinct" : 1}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [], "ndistinct" : 1}]"
LINE 1: SELECT '[{"attributes" : [], "ndistinct" : 1}]'::pg_ndistinc...
@@ -205,32 +205,32 @@ SELECT '[{"attributes" : [2,3], "ndistinct" : null}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : null}]"
LINE 1: SELECT '[{"attributes" : [2,3], "ndistinct" : null}]'::pg_nd...
^
DETAIL: Invalid "ndistinct" value.
DETAIL: Key "ndistinct" has an incorrect value.
SELECT '[{"attributes" : [2,"a"], "ndistinct" : 4}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [2,"a"], "ndistinct" : 4}]"
LINE 1: SELECT '[{"attributes" : [2,"a"], "ndistinct" : 4}]'::pg_ndi...
^
DETAIL: Invalid "attributes" value.
DETAIL: Key "attributes" has an incorrect value.
SELECT '[{"attributes" : [2,3], "ndistinct" : "a"}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : "a"}]"
LINE 1: SELECT '[{"attributes" : [2,3], "ndistinct" : "a"}]'::pg_ndi...
^
DETAIL: Invalid "ndistinct" value.
DETAIL: Key "ndistinct" has an incorrect value.
SELECT '[{"attributes" : [2,3], "ndistinct" : []}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : []}]"
LINE 1: SELECT '[{"attributes" : [2,3], "ndistinct" : []}]'::pg_ndis...
^
DETAIL: Array found in unexpected place.
DETAIL: Array has been found at an unexpected location.
SELECT '[{"attributes" : [2,3], "ndistinct" : [null]}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : [null]}]"
LINE 1: SELECT '[{"attributes" : [2,3], "ndistinct" : [null]}]'::pg_...
^
DETAIL: Array found in unexpected place.
DETAIL: Array has been found at an unexpected location.
SELECT '[{"attributes" : [2,3], "ndistinct" : [1,null]}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : [1,null]}]"
LINE 1: SELECT '[{"attributes" : [2,3], "ndistinct" : [1,null]}]'::p...
^
DETAIL: Array found in unexpected place.
DETAIL: Array has been found at an unexpected location.
SELECT '[{"attributes" : [2,3], "ndistinct" : {"a": 1}}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : {"a": 1}}]"
LINE 1: SELECT '[{"attributes" : [2,3], "ndistinct" : {"a": 1}}]'::p...
@@ -240,22 +240,22 @@ SELECT '[{"attributes" : [0,1], "ndistinct" : 1}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [0,1], "ndistinct" : 1}]"
LINE 1: SELECT '[{"attributes" : [0,1], "ndistinct" : 1}]'::pg_ndist...
^
DETAIL: Invalid "attributes" element: 0.
DETAIL: Invalid "attributes" element has been found: 0.
SELECT '[{"attributes" : [-7,-9], "ndistinct" : 1}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [-7,-9], "ndistinct" : 1}]"
LINE 1: SELECT '[{"attributes" : [-7,-9], "ndistinct" : 1}]'::pg_ndi...
^
DETAIL: Invalid "attributes" element: -9.
DETAIL: Invalid "attributes" element has been found: -9.
SELECT '[{"attributes" : 1, "ndistinct" : 4}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : 1, "ndistinct" : 4}]"
LINE 1: SELECT '[{"attributes" : 1, "ndistinct" : 4}]'::pg_ndistinct...
^
DETAIL: Unexpected scalar.
DETAIL: Unexpected scalar has been found.
SELECT '[{"attributes" : "a", "ndistinct" : 4}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : "a", "ndistinct" : 4}]"
LINE 1: SELECT '[{"attributes" : "a", "ndistinct" : 4}]'::pg_ndistin...
^
DETAIL: Unexpected scalar.
DETAIL: Unexpected scalar has been found.
SELECT '[{"attributes" : {"a": 1}, "ndistinct" : 1}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : {"a": 1}, "ndistinct" : 1}]"
LINE 1: SELECT '[{"attributes" : {"a": 1}, "ndistinct" : 1}]'::pg_nd...
@@ -267,9 +267,9 @@ LINE 1: SELECT '[{"attributes" : [1, {"a": 1}], "ndistinct" : 1}]'::...
^
DETAIL: Attribute lists can only contain attribute numbers.
SELECT * FROM pg_input_error_info('[{"attributes" : null, "ndistinct" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
--------------------------------------------------------------------+--------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : null, "ndistinct" : 4}]" | Unexpected scalar. | | 22P02
message | detail | hint | sql_error_code
--------------------------------------------------------------------+-----------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : null, "ndistinct" : 4}]" | Unexpected scalar has been found. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [], "ndistinct" : 1}]', 'pg_ndistinct');
@@ -291,39 +291,39 @@ SELECT * FROM pg_input_error_info('[{"attributes" : [2,null], "ndistinct" : 4}]'
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "ndistinct" : null}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
------------------------------------------------------------------------+----------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : null}]" | Invalid "ndistinct" value. | | 22P02
message | detail | hint | sql_error_code
------------------------------------------------------------------------+-----------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : null}]" | Key "ndistinct" has an incorrect value. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,"a"], "ndistinct" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
-----------------------------------------------------------------------+-----------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,"a"], "ndistinct" : 4}]" | Invalid "attributes" value. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------------+------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,"a"], "ndistinct" : 4}]" | Key "attributes" has an incorrect value. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "ndistinct" : "a"}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
-----------------------------------------------------------------------+----------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : "a"}]" | Invalid "ndistinct" value. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------------+-----------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : "a"}]" | Key "ndistinct" has an incorrect value. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "ndistinct" : []}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
----------------------------------------------------------------------+----------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : []}]" | Array found in unexpected place. | | 22P02
message | detail | hint | sql_error_code
----------------------------------------------------------------------+-------------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : []}]" | Array has been found at an unexpected location. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "ndistinct" : [null]}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
--------------------------------------------------------------------------+----------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : [null]}]" | Array found in unexpected place. | | 22P02
message | detail | hint | sql_error_code
--------------------------------------------------------------------------+-------------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : [null]}]" | Array has been found at an unexpected location. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "ndistinct" : [1,null]}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
----------------------------------------------------------------------------+----------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : [1,null]}]" | Array found in unexpected place. | | 22P02
message | detail | hint | sql_error_code
----------------------------------------------------------------------------+-------------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : [1,null]}]" | Array has been found at an unexpected location. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "ndistinct" : {"a": 1}}]', 'pg_ndistinct');
@@ -333,27 +333,27 @@ SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "ndistinct" : {"a": 1
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : 1, "ndistinct" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
-----------------------------------------------------------------+--------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : 1, "ndistinct" : 4}]" | Unexpected scalar. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------+-----------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : 1, "ndistinct" : 4}]" | Unexpected scalar has been found. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : [-7,-9], "ndistinct" : 1}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
-----------------------------------------------------------------------+-----------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [-7,-9], "ndistinct" : 1}]" | Invalid "attributes" element: -9. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------------+--------------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [-7,-9], "ndistinct" : 1}]" | Invalid "attributes" element has been found: -9. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : 1, "ndistinct" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
-----------------------------------------------------------------+--------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : 1, "ndistinct" : 4}]" | Unexpected scalar. | | 22P02
message | detail | hint | sql_error_code
-----------------------------------------------------------------+-----------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : 1, "ndistinct" : 4}]" | Unexpected scalar has been found. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : "a", "ndistinct" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
-------------------------------------------------------------------+--------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : "a", "ndistinct" : 4}]" | Unexpected scalar. | | 22P02
message | detail | hint | sql_error_code
-------------------------------------------------------------------+-----------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : "a", "ndistinct" : 4}]" | Unexpected scalar has been found. | | 22P02
(1 row)
SELECT * FROM pg_input_error_info('[{"attributes" : {"a": 1}, "ndistinct" : 1}]', 'pg_ndistinct');
@@ -373,11 +373,11 @@ SELECT '[{"attributes" : [2,2], "ndistinct" : 4}]'::pg_ndistinct;
ERROR: malformed pg_ndistinct: "[{"attributes" : [2,2], "ndistinct" : 4}]"
LINE 1: SELECT '[{"attributes" : [2,2], "ndistinct" : 4}]'::pg_ndist...
^
DETAIL: Invalid "attributes" element: 2 cannot follow 2.
DETAIL: Invalid "attributes" element has been found: 2 cannot follow 2.
SELECT * FROM pg_input_error_info('[{"attributes" : [2,2], "ndistinct" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
---------------------------------------------------------------------+--------------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,2], "ndistinct" : 4}]" | Invalid "attributes" element: 2 cannot follow 2. | | 22P02
message | detail | hint | sql_error_code
---------------------------------------------------------------------+-----------------------------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,2], "ndistinct" : 4}]" | Invalid "attributes" element has been found: 2 cannot follow 2. | | 22P02
(1 row)
-- Duplicated attribute lists.
@@ -387,13 +387,13 @@ ERROR: malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : 4},
{"attributes" : [2,3], "ndistinct" : 4}]"
LINE 1: SELECT '[{"attributes" : [2,3], "ndistinct" : 4},
^
DETAIL: Duplicated "attributes" array found: [2, 3]
DETAIL: Duplicated "attributes" array has been found: [2, 3].
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "ndistinct" : 4},
{"attributes" : [2,3], "ndistinct" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
--------------------------------------------------------------------+---------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : 4},+| Duplicated "attributes" array found: [2, 3] | | 22P02
{"attributes" : [2,3], "ndistinct" : 4}]" | | |
message | detail | hint | sql_error_code
--------------------------------------------------------------------+-------------------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : 4},+| Duplicated "attributes" array has been found: [2, 3]. | | 22P02
{"attributes" : [2,3], "ndistinct" : 4}]" | | |
(1 row)
-- Partially-covered attribute lists.
@@ -407,17 +407,17 @@ ERROR: malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : 4},
{"attributes" : [1,3,-1,-2], "ndistinct" : 4}]"
LINE 1: SELECT '[{"attributes" : [2,3], "ndistinct" : 4},
^
DETAIL: "attributes" array: [2, 3] must be a subset of array: [1, 3, -1, -2]
DETAIL: "attributes" array [2, 3] must be a subset of array [1, 3, -1, -2].
SELECT * FROM pg_input_error_info('[{"attributes" : [2,3], "ndistinct" : 4},
{"attributes" : [2,-1], "ndistinct" : 4},
{"attributes" : [2,3,-1], "ndistinct" : 4},
{"attributes" : [1,3,-1,-2], "ndistinct" : 4}]', 'pg_ndistinct');
message | detail | hint | sql_error_code
--------------------------------------------------------------------+----------------------------------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : 4},+| "attributes" array: [2, 3] must be a subset of array: [1, 3, -1, -2] | | 22P02
{"attributes" : [2,-1], "ndistinct" : 4}, +| | |
{"attributes" : [2,3,-1], "ndistinct" : 4}, +| | |
{"attributes" : [1,3,-1,-2], "ndistinct" : 4}]" | | |
message | detail | hint | sql_error_code
--------------------------------------------------------------------+---------------------------------------------------------------------+------+----------------
malformed pg_ndistinct: "[{"attributes" : [2,3], "ndistinct" : 4},+| "attributes" array [2, 3] must be a subset of array [1, 3, -1, -2]. | | 22P02
{"attributes" : [2,-1], "ndistinct" : 4}, +| | |
{"attributes" : [2,3,-1], "ndistinct" : 4}, +| | |
{"attributes" : [1,3,-1,-2], "ndistinct" : 4}]" | | |
(1 row)
-- Valid inputs