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

Commitd02ef65

Browse files
committed
Standardize error reports in unimplemented I/O functions.
We chose a specific wording of the not-implemented errors forpseudotype I/O functions and other cases where there's littlevalue in implementing input and/or output. gtsvectorin nevergot that memo though, nor did most of contrib. Make these allfall in line, mostly because I'm a neatnik but also to removeunnecessary translatable strings.gbtreekey_in needs a bit of extra love since it supportsmultiple SQL types. Sadly, gbtreekey_out doesn't have theability to do that, but I think it's unreachable anyway.Noted while surveying datatype input functions to see what wehave left to fix.
1 parente730718 commitd02ef65

File tree

6 files changed

+47
-25
lines changed

6 files changed

+47
-25
lines changed

‎contrib/btree_gist/btree_gist.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
#include"postgres.h"
55

6-
#include"btree_gist.h"
6+
#include"utils/builtins.h"
77

88
PG_MODULE_MAGIC;
99

@@ -19,22 +19,26 @@ PG_FUNCTION_INFO_V1(gbtreekey_out);
1919
Datum
2020
gbtreekey_in(PG_FUNCTION_ARGS)
2121
{
22+
Oidtypioparam=PG_GETARG_OID(1);
23+
2224
ereport(ERROR,
2325
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
24-
errmsg("<datatype>key_in() not implemented")));
26+
errmsg("cannot accept a value of type %s",
27+
format_type_extended(typioparam,-1,
28+
FORMAT_TYPE_ALLOW_INVALID))));
2529

26-
PG_RETURN_POINTER(NULL);
30+
PG_RETURN_VOID();/* keep compiler quiet */
2731
}
2832

29-
#include"btree_utils_var.h"
30-
#include"utils/builtins.h"
3133
Datum
3234
gbtreekey_out(PG_FUNCTION_ARGS)
3335
{
36+
/* Sadly, we do not receive any indication of the specific type */
3437
ereport(ERROR,
3538
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
36-
errmsg("<datatype>key_out() not implemented")));
37-
PG_RETURN_POINTER(NULL);
39+
errmsg("cannot display a value of type %s","gbtreekey?")));
40+
41+
PG_RETURN_VOID();/* keep compiler quiet */
3842
}
3943

4044

‎contrib/hstore/hstore_gist.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,21 @@ PG_FUNCTION_INFO_V1(ghstore_out);
9696
Datum
9797
ghstore_in(PG_FUNCTION_ARGS)
9898
{
99-
elog(ERROR,"Not implemented");
100-
PG_RETURN_DATUM(0);
99+
ereport(ERROR,
100+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
101+
errmsg("cannot accept a value of type %s","ghstore")));
102+
103+
PG_RETURN_VOID();/* keep compiler quiet */
101104
}
102105

103106
Datum
104107
ghstore_out(PG_FUNCTION_ARGS)
105108
{
106-
elog(ERROR,"Not implemented");
107-
PG_RETURN_DATUM(0);
109+
ereport(ERROR,
110+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
111+
errmsg("cannot display a value of type %s","ghstore")));
112+
113+
PG_RETURN_VOID();/* keep compiler quiet */
108114
}
109115

110116
staticGISTTYPE*

‎contrib/intarray/_intbig_gist.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,19 @@ _intbig_in(PG_FUNCTION_ARGS)
3232
{
3333
ereport(ERROR,
3434
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
35-
errmsg("_intbig_in() not implemented")));
36-
PG_RETURN_DATUM(0);
35+
errmsg("cannot accept a value of type %s","intbig_gkey")));
36+
37+
PG_RETURN_VOID();/* keep compiler quiet */
3738
}
3839

3940
Datum
4041
_intbig_out(PG_FUNCTION_ARGS)
4142
{
4243
ereport(ERROR,
4344
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
44-
errmsg("_intbig_out() not implemented")));
45-
PG_RETURN_DATUM(0);
45+
errmsg("cannot display a value of type %s","intbig_gkey")));
46+
47+
PG_RETURN_VOID();/* keep compiler quiet */
4648
}
4749

4850
staticGISTTYPE*

‎contrib/ltree/ltree_gist.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@ ltree_gist_in(PG_FUNCTION_ARGS)
2323
{
2424
ereport(ERROR,
2525
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
26-
errmsg("ltree_gist_in() not implemented")));
27-
PG_RETURN_DATUM(0);
26+
errmsg("cannot accept a value of type %s","ltree_gist")));
27+
28+
PG_RETURN_VOID();/* keep compiler quiet */
2829
}
2930

3031
Datum
3132
ltree_gist_out(PG_FUNCTION_ARGS)
3233
{
3334
ereport(ERROR,
3435
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
35-
errmsg("ltree_gist_out() not implemented")));
36-
PG_RETURN_DATUM(0);
36+
errmsg("cannot display a value of type %s","ltree_gist")));
37+
38+
PG_RETURN_VOID();/* keep compiler quiet */
3739
}
3840

3941
ltree_gist*

‎contrib/pg_trgm/trgm_gist.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,21 @@ PG_FUNCTION_INFO_V1(gtrgm_options);
5555
Datum
5656
gtrgm_in(PG_FUNCTION_ARGS)
5757
{
58-
elog(ERROR,"not implemented");
59-
PG_RETURN_DATUM(0);
58+
ereport(ERROR,
59+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
60+
errmsg("cannot accept a value of type %s","gtrgm")));
61+
62+
PG_RETURN_VOID();/* keep compiler quiet */
6063
}
6164

6265
Datum
6366
gtrgm_out(PG_FUNCTION_ARGS)
6467
{
65-
elog(ERROR,"not implemented");
66-
PG_RETURN_DATUM(0);
68+
ereport(ERROR,
69+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
70+
errmsg("cannot display a value of type %s","gtrgm")));
71+
72+
PG_RETURN_VOID();/* keep compiler quiet */
6773
}
6874

6975
staticTRGM*

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ static int32 sizebitvec(BITVECP sign, int siglen);
8787
Datum
8888
gtsvectorin(PG_FUNCTION_ARGS)
8989
{
90+
/* There's no need to support input of gtsvectors */
9091
ereport(ERROR,
9192
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
92-
errmsg("gtsvector_in not implemented")));
93-
PG_RETURN_DATUM(0);
93+
errmsg("cannot accept a value of type %s","gtsvector")));
94+
95+
PG_RETURN_VOID();/* keep compiler quiet */
9496
}
9597

9698
#defineSINGOUTSTR"%d true bits, %d false bits"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp