pgvector.git / summary / log / commit / refs
commit c5c82bafda73a7d7af97db2ba13bd26fd2d9590c
Author: Andrew Kane <andrew@ankane.org>
Date: Sat Apr 13 18:32:47 2024 +0000
Updated invalid input syntax messages to be consistent [skip ci]
src/halfvec.c | 8 ++++----
src/sparsevec.c | 8 ++++----
src/vector.c | 8 ++++----
test/expected/halfvec_input.out | 16 ++++++++--------
test/expected/sparsevec_input.out | 8 ++++----
test/expected/vector_input.out | 16 ++++++++--------
6 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/src/halfvec.c b/src/halfvec.c
index 9e8bb95f..015bf483 100644
--- a/src/halfvec.c
+++ b/src/halfvec.c
@@ -169,7 +169,7 @@ halfvec_in(PG_FUNCTION_ARGS)
if (*str != '[')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed halfvec literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type halfvec: \"%s\"", lit),
errdetail("Vector contents must start with \"[\".")));
str++;
@@ -231,7 +231,7 @@ halfvec_in(PG_FUNCTION_ARGS)
if (stringEnd == NULL || *stringEnd != ']')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed halfvec literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type halfvec: \"%s\"", lit),
errdetail("Unexpected end of input.")));
stringEnd++;
@@ -243,7 +243,7 @@ halfvec_in(PG_FUNCTION_ARGS)
if (*stringEnd != '\0')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed halfvec literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type halfvec: \"%s\"", lit),
errdetail("Junk after closing right brace.")));
/* Ensure no consecutive delimiters since strtok skips */
@@ -252,7 +252,7 @@ halfvec_in(PG_FUNCTION_ARGS)
if (pt[-1] == ',' && *pt == ',')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed halfvec literal: \"%s\"", lit)));
+ errmsg("invalid input syntax for type halfvec: \"%s\"", lit)));
}
if (dim < 1)
diff --git a/src/sparsevec.c b/src/sparsevec.c
index 7c1bd6d2..ca6a8780 100644
--- a/src/sparsevec.c
+++ b/src/sparsevec.c
@@ -209,7 +209,7 @@ sparsevec_in(PG_FUNCTION_ARGS)
if (*str != '{')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed sparsevec literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type sparsevec: \"%s\"", lit),
errdetail("Vector contents must start with \"{\".")));
str++;
@@ -305,7 +305,7 @@ sparsevec_in(PG_FUNCTION_ARGS)
if (stringEnd == NULL || *stringEnd != '}')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed sparsevec literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type sparsevec: \"%s\"", lit),
errdetail("Unexpected end of input.")));
stringEnd++;
@@ -316,7 +316,7 @@ sparsevec_in(PG_FUNCTION_ARGS)
if (*stringEnd != '/')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed sparsevec literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type sparsevec: \"%s\"", lit),
errdetail("Unexpected end of input.")));
stringEnd++;
@@ -341,7 +341,7 @@ sparsevec_in(PG_FUNCTION_ARGS)
if (*stringEnd != '\0')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed sparsevec literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type sparsevec: \"%s\"", lit),
errdetail("Junk after closing.")));
pfree(litcopy);
diff --git a/src/vector.c b/src/vector.c
index 6c1d6044..b029f85a 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -193,7 +193,7 @@ vector_in(PG_FUNCTION_ARGS)
if (*str != '[')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed vector literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type vector: \"%s\"", lit),
errdetail("Vector contents must start with \"[\".")));
str++;
@@ -254,7 +254,7 @@ vector_in(PG_FUNCTION_ARGS)
if (stringEnd == NULL || *stringEnd != ']')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed vector literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type vector: \"%s\"", lit),
errdetail("Unexpected end of input.")));
stringEnd++;
@@ -266,7 +266,7 @@ vector_in(PG_FUNCTION_ARGS)
if (*stringEnd != '\0')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed vector literal: \"%s\"", lit),
+ errmsg("invalid input syntax for type vector: \"%s\"", lit),
errdetail("Junk after closing right brace.")));
/* Ensure no consecutive delimiters since strtok skips */
@@ -275,7 +275,7 @@ vector_in(PG_FUNCTION_ARGS)
if (pt[-1] == ',' && *pt == ',')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("malformed vector literal: \"%s\"", lit)));
+ errmsg("invalid input syntax for type vector: \"%s\"", lit)));
}
if (dim < 1)
diff --git a/test/expected/halfvec_input.out b/test/expected/halfvec_input.out
index 039d657b..575d6d80 100644
--- a/test/expected/halfvec_input.out
+++ b/test/expected/halfvec_input.out
@@ -71,37 +71,37 @@ SELECT '[1e-46,1]'::halfvec;
(1 row)
SELECT '[1,2,3'::halfvec;
-ERROR: malformed halfvec literal: "[1,2,3"
+ERROR: invalid input syntax for type halfvec: "[1,2,3"
LINE 1: SELECT '[1,2,3'::halfvec;
^
DETAIL: Unexpected end of input.
SELECT '[1,2,3]9'::halfvec;
-ERROR: malformed halfvec literal: "[1,2,3]9"
+ERROR: invalid input syntax for type halfvec: "[1,2,3]9"
LINE 1: SELECT '[1,2,3]9'::halfvec;
^
DETAIL: Junk after closing right brace.
SELECT '1,2,3'::halfvec;
-ERROR: malformed halfvec literal: "1,2,3"
+ERROR: invalid input syntax for type halfvec: "1,2,3"
LINE 1: SELECT '1,2,3'::halfvec;
^
DETAIL: Vector contents must start with "[".
SELECT ''::halfvec;
-ERROR: malformed halfvec literal: ""
+ERROR: invalid input syntax for type halfvec: ""
LINE 1: SELECT ''::halfvec;
^
DETAIL: Vector contents must start with "[".
SELECT '['::halfvec;
-ERROR: malformed halfvec literal: "["
+ERROR: invalid input syntax for type halfvec: "["
LINE 1: SELECT '['::halfvec;
^
DETAIL: Unexpected end of input.
SELECT '[ '::halfvec;
-ERROR: malformed halfvec literal: "[ "
+ERROR: invalid input syntax for type halfvec: "[ "
LINE 1: SELECT '[ '::halfvec;
^
DETAIL: Unexpected end of input.
SELECT '[,'::halfvec;
-ERROR: malformed halfvec literal: "[,"
+ERROR: invalid input syntax for type halfvec: "[,"
LINE 1: SELECT '[,'::halfvec;
^
DETAIL: Unexpected end of input.
@@ -127,7 +127,7 @@ ERROR: invalid input syntax for type halfvec: "[1a]"
LINE 1: SELECT '[1a]'::halfvec;
^
SELECT '[1,,3]'::halfvec;
-ERROR: malformed halfvec literal: "[1,,3]"
+ERROR: invalid input syntax for type halfvec: "[1,,3]"
LINE 1: SELECT '[1,,3]'::halfvec;
^
SELECT '[1, ,3]'::halfvec;
diff --git a/test/expected/sparsevec_input.out b/test/expected/sparsevec_input.out
index 25ac56c0..0592e26e 100644
--- a/test/expected/sparsevec_input.out
+++ b/test/expected/sparsevec_input.out
@@ -11,12 +11,12 @@ SELECT ' { 1 : 1.5 , 3 : 3.5 } / 5 '::sparsevec;
(1 row)
SELECT ''::sparsevec;
-ERROR: malformed sparsevec literal: ""
+ERROR: invalid input syntax for type sparsevec: ""
LINE 1: SELECT ''::sparsevec;
^
DETAIL: Vector contents must start with "{".
SELECT '{'::sparsevec;
-ERROR: malformed sparsevec literal: "{"
+ERROR: invalid input syntax for type sparsevec: "{"
LINE 1: SELECT '{'::sparsevec;
^
DETAIL: Unexpected end of input.
@@ -25,7 +25,7 @@ ERROR: invalid input syntax for type sparsevec: "{ "
LINE 1: SELECT '{ '::sparsevec;
^
SELECT '{}'::sparsevec;
-ERROR: malformed sparsevec literal: "{}"
+ERROR: invalid input syntax for type sparsevec: "{}"
LINE 1: SELECT '{}'::sparsevec;
^
DETAIL: Unexpected end of input.
@@ -34,7 +34,7 @@ ERROR: invalid input syntax for type sparsevec: "{}/"
LINE 1: SELECT '{}/'::sparsevec;
^
SELECT '{}/1a'::sparsevec;
-ERROR: malformed sparsevec literal: "{}/1a"
+ERROR: invalid input syntax for type sparsevec: "{}/1a"
LINE 1: SELECT '{}/1a'::sparsevec;
^
DETAIL: Junk after closing.
diff --git a/test/expected/vector_input.out b/test/expected/vector_input.out
index e9eb5f99..81998feb 100644
--- a/test/expected/vector_input.out
+++ b/test/expected/vector_input.out
@@ -83,37 +83,37 @@ SELECT '[-1e-46,1]'::vector;
(1 row)
SELECT '[1,2,3'::vector;
-ERROR: malformed vector literal: "[1,2,3"
+ERROR: invalid input syntax for type vector: "[1,2,3"
LINE 1: SELECT '[1,2,3'::vector;
^
DETAIL: Unexpected end of input.
SELECT '[1,2,3]9'::vector;
-ERROR: malformed vector literal: "[1,2,3]9"
+ERROR: invalid input syntax for type vector: "[1,2,3]9"
LINE 1: SELECT '[1,2,3]9'::vector;
^
DETAIL: Junk after closing right brace.
SELECT '1,2,3'::vector;
-ERROR: malformed vector literal: "1,2,3"
+ERROR: invalid input syntax for type vector: "1,2,3"
LINE 1: SELECT '1,2,3'::vector;
^
DETAIL: Vector contents must start with "[".
SELECT ''::vector;
-ERROR: malformed vector literal: ""
+ERROR: invalid input syntax for type vector: ""
LINE 1: SELECT ''::vector;
^
DETAIL: Vector contents must start with "[".
SELECT '['::vector;
-ERROR: malformed vector literal: "["
+ERROR: invalid input syntax for type vector: "["
LINE 1: SELECT '['::vector;
^
DETAIL: Unexpected end of input.
SELECT '[ '::vector;
-ERROR: malformed vector literal: "[ "
+ERROR: invalid input syntax for type vector: "[ "
LINE 1: SELECT '[ '::vector;
^
DETAIL: Unexpected end of input.
SELECT '[,'::vector;
-ERROR: malformed vector literal: "[,"
+ERROR: invalid input syntax for type vector: "[,"
LINE 1: SELECT '[,'::vector;
^
DETAIL: Unexpected end of input.
@@ -139,7 +139,7 @@ ERROR: invalid input syntax for type vector: "[1a]"
LINE 1: SELECT '[1a]'::vector;
^
SELECT '[1,,3]'::vector;
-ERROR: malformed vector literal: "[1,,3]"
+ERROR: invalid input syntax for type vector: "[1,,3]"
LINE 1: SELECT '[1,,3]'::vector;
^
SELECT '[1, ,3]'::vector;
[parent: f627e69c5f6e]