Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3522d0e

Browse files
committed
Deduplicate "invalid input syntax" messages for various types.
Previously a lot of the error messages referenced the type in theerror message itself. That requires that the message is translatedseparately for each type.Note that currently a few smallint cases continue to reference theinteger, rather than smallint, type. A later patch will create aseparate routine for 16bit input.Author: Andres FreundDiscussion:https://postgr.es/m/20180707200158.wpqkd7rjr4jxq5g7@alap3.anarazel.de
1 parent0426932 commit3522d0e

File tree

20 files changed

+53
-53
lines changed

20 files changed

+53
-53
lines changed

‎contrib/dblink/expected/dblink.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ FROM dblink_fetch('myconn','error_cursor', 1) AS t(i int);
11541154

11551155
SELECT *
11561156
FROM dblink_fetch('myconn','error_cursor', 1) AS t(i int);
1157-
ERROR: invalid input syntax for integer: "not an int"
1157+
ERROR: invalid input syntax fortypeinteger: "not an int"
11581158
-- Make sure that the local settings have retained their values in spite
11591159
-- of shenanigans on the connection.
11601160
SHOW datestyle;

‎contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4087,16 +4087,16 @@ DROP FUNCTION f_test(int);
40874087
-- ===================================================================
40884088
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE int;
40894089
SELECT * FROM ft1 WHERE c1 = 1; -- ERROR
4090-
ERROR: invalid input syntax for integer: "foo"
4090+
ERROR: invalid input syntax fortypeinteger: "foo"
40914091
CONTEXT: column "c8" of foreign table "ft1"
40924092
SELECT ft1.c1, ft2.c2, ft1.c8 FROM ft1, ft2 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = 1; -- ERROR
4093-
ERROR: invalid input syntax for integer: "foo"
4093+
ERROR: invalid input syntax fortypeinteger: "foo"
40944094
CONTEXT: column "c8" of foreign table "ft1"
40954095
SELECT ft1.c1, ft2.c2, ft1 FROM ft1, ft2 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = 1; -- ERROR
4096-
ERROR: invalid input syntax for integer: "foo"
4096+
ERROR: invalid input syntax fortypeinteger: "foo"
40974097
CONTEXT: whole-row reference to foreign table "ft1"
40984098
SELECT sum(c2), array_agg(c8) FROM ft1 GROUP BY c8; -- ERROR
4099-
ERROR: invalid input syntax for integer: "foo"
4099+
ERROR: invalid input syntax fortypeinteger: "foo"
41004100
CONTEXT: processing expression at position 2 in select list
41014101
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE user_enum;
41024102
-- ===================================================================

‎doc/src/sgml/xtypes.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ complex_in(PG_FUNCTION_ARGS)
8686
if (sscanf(str, " ( %lf , %lf )", &x, &y) != 2)
8787
ereport(ERROR,
8888
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
89-
errmsg("invalid input syntax forcomplex: \"%s\"",
90-
str)));
89+
errmsg("invalid input syntax fortype %s: \"%s\"",
90+
"complex",str)));
9191

9292
result = (Complex *) palloc(sizeof(Complex));
9393
result->x = x;

‎src/backend/utils/adt/int8.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ scanint8(const char *str, bool errorOK, int64 *result)
121121
if (!errorOK)
122122
ereport(ERROR,
123123
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
124-
errmsg("invalid input syntax forinteger: \"%s\"",
125-
str)));
124+
errmsg("invalid input syntax fortype %s: \"%s\"",
125+
"bigint",str)));
126126
return false;
127127
}
128128

‎src/backend/utils/adt/numutils.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ pg_atoi(const char *s, int size, int c)
4848
if (*s==0)
4949
ereport(ERROR,
5050
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
51-
errmsg("invalid input syntax forinteger: \"%s\"",
52-
s)));
51+
errmsg("invalid input syntax fortype %s: \"%s\"",
52+
"integer",s)));
5353

5454
errno=0;
5555
l=strtol(s,&badp,10);
@@ -58,8 +58,8 @@ pg_atoi(const char *s, int size, int c)
5858
if (s==badp)
5959
ereport(ERROR,
6060
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
61-
errmsg("invalid input syntax forinteger: \"%s\"",
62-
s)));
61+
errmsg("invalid input syntax fortype %s: \"%s\"",
62+
"integer",s)));
6363

6464
switch (size)
6565
{
@@ -102,8 +102,8 @@ pg_atoi(const char *s, int size, int c)
102102
if (*badp&&*badp!=c)
103103
ereport(ERROR,
104104
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
105-
errmsg("invalid input syntax forinteger: \"%s\"",
106-
s)));
105+
errmsg("invalid input syntax fortype %s: \"%s\"",
106+
"integer",s)));
107107

108108
return (int32)l;
109109
}

‎src/backend/utils/adt/timestamp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ parse_sane_timezone(struct pg_tm *tm, text *zone)
480480
if (isdigit((unsignedchar)*tzname))
481481
ereport(ERROR,
482482
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
483-
errmsg("invalid input syntax fornumeric time zone: \"%s\"",
484-
tzname),
483+
errmsg("invalid input syntax fortype %s: \"%s\"",
484+
"numeric time zone",tzname),
485485
errhint("Numeric time zones must have \"-\" or \"+\" as first character.")));
486486

487487
rt=DecodeTimezone(tzname,&tz);

‎src/pl/plpython/expected/plpython_subtransaction.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ SELECT * FROM subtransaction_tbl;
4343

4444
TRUNCATE subtransaction_tbl;
4545
SELECT subtransaction_test('SPI');
46-
ERROR: spiexceptions.InvalidTextRepresentation: invalid input syntax for integer: "oops"
46+
ERROR: spiexceptions.InvalidTextRepresentation: invalid input syntax fortypeinteger: "oops"
4747
LINE 1: INSERT INTO subtransaction_tbl VALUES ('oops')
4848
^
4949
QUERY: INSERT INTO subtransaction_tbl VALUES ('oops')
@@ -95,7 +95,7 @@ SELECT * FROM subtransaction_tbl;
9595

9696
TRUNCATE subtransaction_tbl;
9797
SELECT subtransaction_ctx_test('SPI');
98-
ERROR: spiexceptions.InvalidTextRepresentation: invalid input syntax for integer: "oops"
98+
ERROR: spiexceptions.InvalidTextRepresentation: invalid input syntax fortypeinteger: "oops"
9999
LINE 1: INSERT INTO subtransaction_tbl VALUES ('oops')
100100
^
101101
QUERY: INSERT INTO subtransaction_tbl VALUES ('oops')

‎src/pl/plpython/expected/plpython_types.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ CREATE FUNCTION test_type_conversion_array_mixed2() RETURNS int[] AS $$
684684
return [123, 'abc']
685685
$$ LANGUAGE plpythonu;
686686
SELECT * FROM test_type_conversion_array_mixed2();
687-
ERROR: invalid input syntax for integer: "abc"
687+
ERROR: invalid input syntax fortypeinteger: "abc"
688688
CONTEXT: while creating return value
689689
PL/Python function "test_type_conversion_array_mixed2"
690690
CREATE FUNCTION test_type_conversion_mdarray_malformed() RETURNS int[] AS $$

‎src/pl/tcl/expected/pltcl_subxact.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ SELECT * FROM subtransaction_tbl;
7171

7272
TRUNCATE subtransaction_tbl;
7373
SELECT pltcl_wrapper('SELECT subtransaction_ctx_test(''SPI'')');
74-
pltcl_wrapper
75-
-------------------------------------------------
76-
ERROR: invalid input syntax for integer: "oops"
74+
pltcl_wrapper
75+
------------------------------------------------------
76+
ERROR: invalid input syntax fortypeinteger: "oops"
7777
(1 row)
7878

7979
SELECT * FROM subtransaction_tbl;

‎src/test/regress/expected/aggregates.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ LINE 1: select rank(3) within group (order by stringu1,stringu2) fro...
16741674
^
16751675
HINT: To use the hypothetical-set aggregate rank, the number of hypothetical direct arguments (here 1) must match the number of ordering columns (here 2).
16761676
select rank('fred') within group (order by x) from generate_series(1,5) x;
1677-
ERROR: invalid input syntax for integer: "fred"
1677+
ERROR: invalid input syntax fortypeinteger: "fred"
16781678
LINE 1: select rank('fred') within group (order by x) from generate_...
16791679
^
16801680
select rank('adam'::text collate "C") within group (order by x collate "POSIX")

‎src/test/regress/expected/alter_table.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ select * from def_test;
11131113

11141114
-- set defaults to an incorrect type: this should fail
11151115
alter table def_test alter column c1 set default 'wrong_datatype';
1116-
ERROR: invalid input syntax for integer: "wrong_datatype"
1116+
ERROR: invalid input syntax fortypeinteger: "wrong_datatype"
11171117
alter table def_test alter column c2 set default 20;
11181118
-- set defaults on a non-existent column: this should fail
11191119
alter table def_test alter column c3 set default 30;

‎src/test/regress/expected/copy2.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ COPY x (a, b, c, d, e, d, c) from stdin;
3333
ERROR: column "d" specified more than once
3434
-- missing data: should fail
3535
COPY x from stdin;
36-
ERROR: invalid input syntax for integer: ""
36+
ERROR: invalid input syntax fortypeinteger: ""
3737
CONTEXT: COPY x, line 1, column a: ""
3838
COPY x from stdin;
3939
ERROR: missing data for column "e"

‎src/test/regress/expected/int2.out

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ INSERT INTO INT2_TBL(f1) VALUES ('0 ');
66
INSERT INTO INT2_TBL(f1) VALUES (' 1234 ');
77
INSERT INTO INT2_TBL(f1) VALUES (' -1234');
88
INSERT INTO INT2_TBL(f1) VALUES ('34.5');
9-
ERROR: invalid input syntax for integer: "34.5"
9+
ERROR: invalid input syntax fortypeinteger: "34.5"
1010
LINE 1: INSERT INTO INT2_TBL(f1) VALUES ('34.5');
1111
^
1212
-- largest and smallest values
@@ -18,27 +18,27 @@ ERROR: value "100000" is out of range for type smallint
1818
LINE 1: INSERT INTO INT2_TBL(f1) VALUES ('100000');
1919
^
2020
INSERT INTO INT2_TBL(f1) VALUES ('asdf');
21-
ERROR: invalid input syntax for integer: "asdf"
21+
ERROR: invalid input syntax fortypeinteger: "asdf"
2222
LINE 1: INSERT INTO INT2_TBL(f1) VALUES ('asdf');
2323
^
2424
INSERT INTO INT2_TBL(f1) VALUES (' ');
25-
ERROR: invalid input syntax for integer: " "
25+
ERROR: invalid input syntax fortypeinteger: " "
2626
LINE 1: INSERT INTO INT2_TBL(f1) VALUES (' ');
2727
^
2828
INSERT INTO INT2_TBL(f1) VALUES ('- 1234');
29-
ERROR: invalid input syntax for integer: "- 1234"
29+
ERROR: invalid input syntax fortypeinteger: "- 1234"
3030
LINE 1: INSERT INTO INT2_TBL(f1) VALUES ('- 1234');
3131
^
3232
INSERT INTO INT2_TBL(f1) VALUES ('4 444');
33-
ERROR: invalid input syntax for integer: "4 444"
33+
ERROR: invalid input syntax fortypeinteger: "4 444"
3434
LINE 1: INSERT INTO INT2_TBL(f1) VALUES ('4 444');
3535
^
3636
INSERT INTO INT2_TBL(f1) VALUES ('123 dt');
37-
ERROR: invalid input syntax for integer: "123 dt"
37+
ERROR: invalid input syntax fortypeinteger: "123 dt"
3838
LINE 1: INSERT INTO INT2_TBL(f1) VALUES ('123 dt');
3939
^
4040
INSERT INTO INT2_TBL(f1) VALUES ('');
41-
ERROR: invalid input syntax for integer: ""
41+
ERROR: invalid input syntax fortypeinteger: ""
4242
LINE 1: INSERT INTO INT2_TBL(f1) VALUES ('');
4343
^
4444
SELECT '' AS five, * FROM INT2_TBL;

‎src/test/regress/expected/int4.out

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ INSERT INTO INT4_TBL(f1) VALUES (' 0 ');
66
INSERT INTO INT4_TBL(f1) VALUES ('123456 ');
77
INSERT INTO INT4_TBL(f1) VALUES (' -123456');
88
INSERT INTO INT4_TBL(f1) VALUES ('34.5');
9-
ERROR: invalid input syntax for integer: "34.5"
9+
ERROR: invalid input syntax fortypeinteger: "34.5"
1010
LINE 1: INSERT INTO INT4_TBL(f1) VALUES ('34.5');
1111
^
1212
-- largest and smallest values
@@ -18,27 +18,27 @@ ERROR: value "1000000000000" is out of range for type integer
1818
LINE 1: INSERT INTO INT4_TBL(f1) VALUES ('1000000000000');
1919
^
2020
INSERT INTO INT4_TBL(f1) VALUES ('asdf');
21-
ERROR: invalid input syntax for integer: "asdf"
21+
ERROR: invalid input syntax fortypeinteger: "asdf"
2222
LINE 1: INSERT INTO INT4_TBL(f1) VALUES ('asdf');
2323
^
2424
INSERT INTO INT4_TBL(f1) VALUES (' ');
25-
ERROR: invalid input syntax for integer: " "
25+
ERROR: invalid input syntax fortypeinteger: " "
2626
LINE 1: INSERT INTO INT4_TBL(f1) VALUES (' ');
2727
^
2828
INSERT INTO INT4_TBL(f1) VALUES (' asdf ');
29-
ERROR: invalid input syntax for integer: " asdf "
29+
ERROR: invalid input syntax fortypeinteger: " asdf "
3030
LINE 1: INSERT INTO INT4_TBL(f1) VALUES (' asdf ');
3131
^
3232
INSERT INTO INT4_TBL(f1) VALUES ('- 1234');
33-
ERROR: invalid input syntax for integer: "- 1234"
33+
ERROR: invalid input syntax fortypeinteger: "- 1234"
3434
LINE 1: INSERT INTO INT4_TBL(f1) VALUES ('- 1234');
3535
^
3636
INSERT INTO INT4_TBL(f1) VALUES ('123 5');
37-
ERROR: invalid input syntax for integer: "123 5"
37+
ERROR: invalid input syntax fortypeinteger: "123 5"
3838
LINE 1: INSERT INTO INT4_TBL(f1) VALUES ('123 5');
3939
^
4040
INSERT INTO INT4_TBL(f1) VALUES ('');
41-
ERROR: invalid input syntax for integer: ""
41+
ERROR: invalid input syntax fortypeinteger: ""
4242
LINE 1: INSERT INTO INT4_TBL(f1) VALUES ('');
4343
^
4444
SELECT '' AS five, * FROM INT4_TBL;

‎src/test/regress/expected/int8.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ INSERT INTO INT8_TBL VALUES(+4567890123456789,'4567890123456789');
1010
INSERT INTO INT8_TBL VALUES('+4567890123456789','-4567890123456789');
1111
-- bad inputs
1212
INSERT INTO INT8_TBL(q1) VALUES (' ');
13-
ERROR: invalid input syntax forinteger: " "
13+
ERROR: invalid input syntax fortype bigint: " "
1414
LINE 1: INSERT INTO INT8_TBL(q1) VALUES (' ');
1515
^
1616
INSERT INTO INT8_TBL(q1) VALUES ('xxx');
17-
ERROR: invalid input syntax forinteger: "xxx"
17+
ERROR: invalid input syntax fortype bigint: "xxx"
1818
LINE 1: INSERT INTO INT8_TBL(q1) VALUES ('xxx');
1919
^
2020
INSERT INTO INT8_TBL(q1) VALUES ('3908203590239580293850293850329485');
@@ -26,15 +26,15 @@ ERROR: value "-1204982019841029840928340329840934" is out of range for type big
2626
LINE 1: INSERT INTO INT8_TBL(q1) VALUES ('-1204982019841029840928340...
2727
^
2828
INSERT INTO INT8_TBL(q1) VALUES ('- 123');
29-
ERROR: invalid input syntax forinteger: "- 123"
29+
ERROR: invalid input syntax fortype bigint: "- 123"
3030
LINE 1: INSERT INTO INT8_TBL(q1) VALUES ('- 123');
3131
^
3232
INSERT INTO INT8_TBL(q1) VALUES (' 345 5');
33-
ERROR: invalid input syntax forinteger: " 345 5"
33+
ERROR: invalid input syntax fortype bigint: " 345 5"
3434
LINE 1: INSERT INTO INT8_TBL(q1) VALUES (' 345 5');
3535
^
3636
INSERT INTO INT8_TBL(q1) VALUES ('');
37-
ERROR: invalid input syntax forinteger: ""
37+
ERROR: invalid input syntax fortype bigint: ""
3838
LINE 1: INSERT INTO INT8_TBL(q1) VALUES ('');
3939
^
4040
SELECT * FROM INT8_TBL;

‎src/test/regress/expected/plpgsql.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,7 +3782,7 @@ begin
37823782
end;
37833783
$$ language plpgsql;
37843784
select compos();
3785-
ERROR: invalid input syntax for integer: "(1,hello)"
3785+
ERROR: invalid input syntax fortypeinteger: "(1,hello)"
37863786
CONTEXT: PL/pgSQL function compos() while casting return value to function's return type
37873787
-- test: invalid use of composite expression in scalar-returning function
37883788
create or replace function compos() returns int as $$
@@ -3791,7 +3791,7 @@ begin
37913791
end;
37923792
$$ language plpgsql;
37933793
select compos();
3794-
ERROR: invalid input syntax for integer: "(1,hello)"
3794+
ERROR: invalid input syntax fortypeinteger: "(1,hello)"
37953795
CONTEXT: PL/pgSQL function compos() while casting return value to function's return type
37963796
drop function compos();
37973797
drop type compostype;

‎src/test/regress/expected/select_parallel.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ ROLLBACK TO SAVEPOINT settings;
975975
SAVEPOINT settings;
976976
SET LOCAL force_parallel_mode = 1;
977977
select stringu1::int2 from tenk1 where unique1 = 1;
978-
ERROR: invalid input syntax for integer: "BAAAAA"
978+
ERROR: invalid input syntax fortypeinteger: "BAAAAA"
979979
CONTEXT: parallel worker
980980
ROLLBACK TO SAVEPOINT settings;
981981
-- test interaction with set-returning functions

‎src/test/regress/expected/timestamptz.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,7 @@ WITH tzs (tz) AS (VALUES
18341834

18351835
-- these should fail
18361836
SELECT make_timestamptz(1973, 07, 15, 08, 15, 55.33, '2');
1837-
ERROR: invalid input syntax for numeric time zone: "2"
1837+
ERROR: invalid input syntax fortypenumeric time zone: "2"
18381838
HINT: Numeric time zones must have "-" or "+" as first character.
18391839
SELECT make_timestamptz(2014, 12, 10, 10, 10, 10, '+16');
18401840
ERROR: numeric time zone "+16" out of range

‎src/test/regress/regress.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ widget_in(PG_FUNCTION_ARGS)
148148
if (i<NARGS)
149149
ereport(ERROR,
150150
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
151-
errmsg("invalid input syntax for typewidget: \"%s\"",
152-
str)));
151+
errmsg("invalid input syntax for type%s: \"%s\"",
152+
"widget",str)));
153153

154154
result= (WIDGET*)palloc(sizeof(WIDGET));
155155
result->center.x=atof(coord[0]);

‎src/tutorial/complex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ complex_in(PG_FUNCTION_ARGS)
3838
if (sscanf(str," ( %lf , %lf )",&x,&y)!=2)
3939
ereport(ERROR,
4040
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
41-
errmsg("invalid input syntax forcomplex: \"%s\"",
42-
str)));
41+
errmsg("invalid input syntax fortype %s: \"%s\"",
42+
"complex",str)));
4343

4444
result= (Complex*)palloc(sizeof(Complex));
4545
result->x=x;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp