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

Commit8402fab

Browse files
committed
file_fdw: Improve error message
The hint looked a bit confusing when there were no valid options tohint about.
1 parent4ad5cbe commit8402fab

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

‎contrib/file_fdw/file_fdw.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ file_fdw_validator(PG_FUNCTION_ARGS)
230230
ereport(ERROR,
231231
(errcode(ERRCODE_FDW_INVALID_OPTION_NAME),
232232
errmsg("invalid option \"%s\"",def->defname),
233-
errhint("Valid options in this context are: %s",
234-
buf.data)));
233+
buf.len>0
234+
?errhint("Valid options in this context are: %s",
235+
buf.data)
236+
:errhint("There are no valid options in this context.")));
235237
}
236238

237239
/*

‎contrib/file_fdw/output/file_fdw.source

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ SELECT * FROM text_csv;
114114
-- force_not_null is not allowed to be specified at any foreign object level:
115115
ALTER FOREIGN DATA WRAPPER file_fdw OPTIONS (ADD force_not_null '*'); -- ERROR
116116
ERROR: invalid option "force_not_null"
117-
HINT:Validoptions in this context are:
117+
HINT:There are no validoptions in this context.
118118
ALTER SERVER file_server OPTIONS (ADD force_not_null '*'); -- ERROR
119119
ERROR: invalid option "force_not_null"
120-
HINT:Validoptions in this context are:
120+
HINT:There are no validoptions in this context.
121121
CREATE USER MAPPING FOR public SERVER file_server OPTIONS (force_not_null '*'); -- ERROR
122122
ERROR: invalid option "force_not_null"
123-
HINT:Validoptions in this context are:
123+
HINT:There are no validoptions in this context.
124124
CREATE FOREIGN TABLE tbl () SERVER file_server OPTIONS (force_not_null '*'); -- ERROR
125125
ERROR: invalid option "force_not_null"
126126
HINT: Valid options in this context are: filename, format, header, delimiter, quote, escape, null, encoding

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp