1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-01 01:04:50 +03:00

Simplify and clarify an error message

This commit is contained in:
Peter Eisentraut 2022-08-18 11:33:53 +02:00
parent f340f97a13
commit 08909e3aee
2 changed files with 5 additions and 5 deletions

View File

@ -782,7 +782,7 @@ NextCopyFromRawFields(CopyFromState cstate, char ***fields, int *nfields)
if (fldct != list_length(cstate->attnumlist)) if (fldct != list_length(cstate->attnumlist))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT), (errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("wrong number of fields in header line: field count is %d, expected %d", errmsg("wrong number of fields in header line: got %d, expected %d",
fldct, list_length(cstate->attnumlist)))); fldct, list_length(cstate->attnumlist))));
fldnum = 0; fldnum = 0;

View File

@ -201,10 +201,10 @@ copy header_copytest from stdin with (header match);
ERROR: column name mismatch in header line field 3: got null value ("\N"), expected "c" ERROR: column name mismatch in header line field 3: got null value ("\N"), expected "c"
CONTEXT: COPY header_copytest, line 1: "a b \N" CONTEXT: COPY header_copytest, line 1: "a b \N"
copy header_copytest from stdin with (header match); copy header_copytest from stdin with (header match);
ERROR: wrong number of fields in header line: field count is 2, expected 3 ERROR: wrong number of fields in header line: got 2, expected 3
CONTEXT: COPY header_copytest, line 1: "a b" CONTEXT: COPY header_copytest, line 1: "a b"
copy header_copytest from stdin with (header match); copy header_copytest from stdin with (header match);
ERROR: wrong number of fields in header line: field count is 4, expected 3 ERROR: wrong number of fields in header line: got 4, expected 3
CONTEXT: COPY header_copytest, line 1: "a b c d" CONTEXT: COPY header_copytest, line 1: "a b c d"
copy header_copytest from stdin with (header match); copy header_copytest from stdin with (header match);
ERROR: column name mismatch in header line field 3: got "d", expected "c" ERROR: column name mismatch in header line field 3: got "d", expected "c"
@ -224,10 +224,10 @@ copy header_copytest (c, a) from stdin with (header match);
copy header_copytest (a, c) from stdin with (header match); copy header_copytest (a, c) from stdin with (header match);
-- errors -- errors
copy header_copytest from stdin with (header match); copy header_copytest from stdin with (header match);
ERROR: wrong number of fields in header line: field count is 3, expected 2 ERROR: wrong number of fields in header line: got 3, expected 2
CONTEXT: COPY header_copytest, line 1: "a ........pg.dropped.2........ c" CONTEXT: COPY header_copytest, line 1: "a ........pg.dropped.2........ c"
copy header_copytest (a, c) from stdin with (header match); copy header_copytest (a, c) from stdin with (header match);
ERROR: wrong number of fields in header line: field count is 3, expected 2 ERROR: wrong number of fields in header line: got 3, expected 2
CONTEXT: COPY header_copytest, line 1: "a c b" CONTEXT: COPY header_copytest, line 1: "a c b"
SELECT * FROM header_copytest ORDER BY a; SELECT * FROM header_copytest ORDER BY a;
a | c a | c