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

Commitdbe2328

Browse files
committed
Fix assorted inconsistencies in GIN opclass support function declarations.
GIN had some minor issues too, mostly using "internal" where somethingelse would be more appropriate. I went with the same approach as in9ff6027, namely preferring the opclass' indexed datatype forarguments that receive an operator RHS value, even if that's notnecessarily what they really are.Again, this is with an eye to having a uniform rule for ginvalidate()to check support function signatures.
1 parent948c979 commitdbe2328

File tree

6 files changed

+51
-45
lines changed

6 files changed

+51
-45
lines changed

‎contrib/hstore/hstore--1.3.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,17 +521,17 @@ AS
521521

522522
-- GIN support
523523

524-
CREATEFUNCTIONgin_extract_hstore(internal, internal)
524+
CREATEFUNCTIONgin_extract_hstore(hstore, internal)
525525
RETURNS internal
526526
AS'MODULE_PATHNAME'
527527
LANGUAGE C IMMUTABLE STRICT;
528528

529-
CREATEFUNCTIONgin_extract_hstore_query(internal, internal, int2, internal, internal)
529+
CREATEFUNCTIONgin_extract_hstore_query(hstore, internal, int2, internal, internal)
530530
RETURNS internal
531531
AS'MODULE_PATHNAME'
532532
LANGUAGE C IMMUTABLE STRICT;
533533

534-
CREATEFUNCTIONgin_consistent_hstore(internal, int2,internal, int4, internal, internal)
534+
CREATEFUNCTIONgin_consistent_hstore(internal, int2,hstore, int4, internal, internal)
535535
RETURNS bool
536536
AS'MODULE_PATHNAME'
537537
LANGUAGE C IMMUTABLE STRICT;
@@ -544,7 +544,7 @@ AS
544544
OPERATOR10 ?|(hstore,text[]),
545545
OPERATOR11 ?&(hstore,text[]),
546546
FUNCTION1 bttextcmp(text,text),
547-
FUNCTION2 gin_extract_hstore(internal, internal),
548-
FUNCTION3 gin_extract_hstore_query(internal, internal, int2, internal, internal),
549-
FUNCTION4 gin_consistent_hstore(internal, int2,internal, int4, internal, internal),
547+
FUNCTION2 gin_extract_hstore(hstore, internal),
548+
FUNCTION3 gin_extract_hstore_query(hstore, internal, int2, internal, internal),
549+
FUNCTION4 gin_consistent_hstore(internal, int2,hstore, int4, internal, internal),
550550
STORAGEtext;

‎contrib/intarray/intarray--1.1.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,12 +493,12 @@ AS
493493

494494
--GIN
495495

496-
CREATEFUNCTIONginint4_queryextract(internal, internal, int2, internal, internal, internal, internal)
496+
CREATEFUNCTIONginint4_queryextract(_int4, internal, int2, internal, internal, internal, internal)
497497
RETURNS internal
498498
AS'MODULE_PATHNAME'
499499
LANGUAGE C IMMUTABLE STRICT;
500500

501-
CREATEFUNCTIONginint4_consistent(internal, int2,internal, int4, internal, internal, internal, internal)
501+
CREATEFUNCTIONginint4_consistent(internal, int2,_int4, int4, internal, internal, internal, internal)
502502
RETURNS bool
503503
AS'MODULE_PATHNAME'
504504
LANGUAGE C IMMUTABLE STRICT;
@@ -515,6 +515,6 @@ AS
515515
OPERATOR20@@ (_int4, query_int),
516516
FUNCTION1btint4cmp (int4, int4),
517517
FUNCTION2ginarrayextract (anyarray, internal, internal),
518-
FUNCTION3ginint4_queryextract (internal, internal, int2, internal, internal, internal, internal),
519-
FUNCTION4ginint4_consistent (internal, int2,internal, int4, internal, internal, internal, internal),
518+
FUNCTION3ginint4_queryextract (_int4, internal, int2, internal, internal, internal, internal),
519+
FUNCTION4ginint4_consistent (internal, int2,_int4, int4, internal, internal, internal, internal),
520520
STORAGEint4;

‎contrib/tsearch2/tsearch2--1.0.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,8 @@ AS
552552
OPERATOR2 @@@ (tsvector, tsquery),
553553
FUNCTION1 bttextcmp(text,text),
554554
FUNCTION2 gin_extract_tsvector(tsvector,internal,internal),
555-
FUNCTION3 gin_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
556-
FUNCTION4 gin_tsquery_consistent(internal,smallint,tsquery,int,internal,internal,internal,internal),
555+
FUNCTION3 gin_extract_tsquery(tsvector,internal,smallint,internal,internal,internal,internal),
556+
FUNCTION4 gin_tsquery_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
557557
FUNCTION5 gin_cmp_prefix(text,text,smallint,internal),
558558
STORAGEtext;
559559

‎doc/src/sgml/gin.sgml

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -556,10 +556,11 @@
556556
matches the query. It comes in two flavors, a boolean <function>consistent</>
557557
function, and a ternary <function>triConsistent</> function.
558558
<function>triConsistent</> covers the functionality of both, so providing
559-
triConsistent alone is sufficient. However, if the boolean variant is
560-
significantly cheaper to calculate, it can be advantageous to provide both.
561-
If only the boolean variant is provided, some optimizations that depend on
562-
refuting index items before fetching all the keys are disabled.
559+
<function>triConsistent</> alone is sufficient. However, if the boolean
560+
variant is significantly cheaper to calculate, it can be advantageous to
561+
provide both. If only the boolean variant is provided, some optimizations
562+
that depend on refuting index items before fetching all the keys are
563+
disabled.
563564

564565
<variablelist>
565566
<varlistentry>
@@ -620,23 +621,26 @@
620621
<listitem>
621622
<para>
622623
<function>triConsistent</> is similar to <function>consistent</>,
623-
but instead of a boolean <literal>check[]</>, there are three possible
624-
values for each key: <literal>GIN_TRUE</>, <literal>GIN_FALSE</> and
624+
but instead of booleans in the <literal>check</> vector, there are
625+
three possible values for each
626+
key: <literal>GIN_TRUE</>, <literal>GIN_FALSE</> and
625627
<literal>GIN_MAYBE</>. <literal>GIN_FALSE</> and <literal>GIN_TRUE</>
626-
have the same meaning as regular boolean values.
628+
have the same meaning as regular boolean values, while
627629
<literal>GIN_MAYBE</> means that the presence of that key is not known.
628630
When <literal>GIN_MAYBE</> values are present, the function should only
629-
return GIN_TRUE if the item matches whether or not the index item
630-
contains the corresponding query keys. Likewise, the function must
631-
return GIN_FALSE only if the item does not match, whether or not it
632-
contains the GIN_MAYBE keys. If the result depends on the GIN_MAYBE
633-
entries, i.e. the match cannot be confirmed or refuted based on the
634-
known query keys, the function must return GIN_MAYBE.
631+
return <literal>GIN_TRUE</> if the item certainly matches whether or
632+
not the index item contains the corresponding query keys. Likewise, the
633+
function must return <literal>GIN_FALSE</> only if the item certainly
634+
does not match, whether or not it contains the <literal>GIN_MAYBE</>
635+
keys. If the result depends on the <literal>GIN_MAYBE</> entries, i.e.,
636+
the match cannot be confirmed or refuted based on the known query keys,
637+
the function must return <literal>GIN_MAYBE</>.
635638
</para>
636639
<para>
637-
When there are no GIN_MAYBE values in the <literal>check</> vector,
638-
<literal>GIN_MAYBE</> return value is equivalent of setting
639-
<literal>recheck</> flag in the boolean <function>consistent</> function.
640+
When there are no <literal>GIN_MAYBE</> values in the <literal>check</>
641+
vector, a <literal>GIN_MAYBE</> return value is the equivalent of
642+
setting the <literal>recheck</> flag in the
643+
boolean <function>consistent</> function.
640644
</para>
641645
</listitem>
642646
</varlistentry>
@@ -682,11 +686,13 @@
682686
<function>extractValue</> are always of the operator class's input type, and
683687
all key values must be of the class's <literal>STORAGE</> type. The type of
684688
the <literal>query</> argument passed to <function>extractQuery</>,
685-
<function>consistent</> and <function>triConsistent</> is whatever is
686-
specified as the right-hand input
687-
type of the class member operator identified by the strategy number.
688-
This need not be the same as the item type, so long as key values of the
689-
correct type can be extracted from it.
689+
<function>consistent</> and <function>triConsistent</> is whatever is the
690+
right-hand input type of the class member operator identified by the
691+
strategy number. This need not be the same as the indexed type, so long as
692+
key values of the correct type can be extracted from it. However, it is
693+
recommended that the SQL declarations of these three support functions use
694+
the opclass's indexed data type for the <literal>query</> argument, even
695+
though the actual type might be something else depending on the operator.
690696
</para>
691697

692698
</sect1>

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201601191
56+
#defineCATALOG_VERSION_NO201601192
5757

5858
#endif

‎src/include/catalog/pg_proc.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4483,11 +4483,11 @@ DESCR("GiST tsvector support");
44834483

44844484
DATA(insert OID = 3656 ( gin_extract_tsvectorPGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "3614 2281 2281" _null_ _null_ _null_ _null_ _null_gin_extract_tsvector _null_ _null_ _null_ ));
44854485
DESCR("GIN tsvector support");
4486-
DATA(insert OID = 3657 ( gin_extract_tsqueryPGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 2281 "3615 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_tsquery _null_ _null_ _null_ ));
4486+
DATA(insert OID = 3657 ( gin_extract_tsqueryPGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 2281 "3614 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_tsquery _null_ _null_ _null_ ));
44874487
DESCR("GIN tsvector support");
4488-
DATA(insert OID = 3658 ( gin_tsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 8 0 16 "2281 213615 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_gin_tsquery_consistent _null_ _null_ _null_ ));
4488+
DATA(insert OID = 3658 ( gin_tsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 8 0 16 "2281 213614 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_gin_tsquery_consistent _null_ _null_ _null_ ));
44894489
DESCR("GIN tsvector support");
4490-
DATA(insert OID = 3921 ( gin_tsquery_triconsistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 18 "2281 213615 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_tsquery_triconsistent _null_ _null_ _null_ ));
4490+
DATA(insert OID = 3921 ( gin_tsquery_triconsistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 18 "2281 213614 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_tsquery_triconsistent _null_ _null_ _null_ ));
44914491
DESCR("GIN tsvector support");
44924492
DATA(insert OID = 3724 ( gin_cmp_tslexemePGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 23 "25 25" _null_ _null_ _null_ _null_ _null_ gin_cmp_tslexeme _null_ _null_ _null_ ));
44934493
DESCR("GIN tsvector support");
@@ -4752,21 +4752,21 @@ DATA(insert OID = 4050 ( jsonb_containedPGNSP PGUID 12 1 0 0 0 f f f f t f i s
47524752
DESCR("implementation of <@ operator");
47534753
DATA(insert OID = 3480 ( gin_compare_jsonb PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 23 "25 25" _null_ _null_ _null_ _null_ _null_ gin_compare_jsonb _null_ _null_ _null_ ));
47544754
DESCR("GIN support");
4755-
DATA(insert OID = 3482 ( gin_extract_jsonb PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb _null_ _null_ _null_ ));
4755+
DATA(insert OID = 3482 ( gin_extract_jsonb PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "3802 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb _null_ _null_ _null_ ));
47564756
DESCR("GIN support");
4757-
DATA(insert OID = 3483 ( gin_extract_jsonb_query PGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 2281 "2277 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb_query _null_ _null_ _null_ ));
4757+
DATA(insert OID = 3483 ( gin_extract_jsonb_query PGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 2281 "3802 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb_query _null_ _null_ _null_ ));
47584758
DESCR("GIN support");
4759-
DATA(insert OID = 3484 ( gin_consistent_jsonbPGNSP PGUID 12 1 0 0 0 f f f f t f i s 8 0 16 "2281 212277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_consistent_jsonb _null_ _null_ _null_ ));
4759+
DATA(insert OID = 3484 ( gin_consistent_jsonbPGNSP PGUID 12 1 0 0 0 f f f f t f i s 8 0 16 "2281 213802 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_consistent_jsonb _null_ _null_ _null_ ));
47604760
DESCR("GIN support");
4761-
DATA(insert OID = 3488 ( gin_triconsistent_jsonbPGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 18 "2281 212277 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_triconsistent_jsonb _null_ _null_ _null_ ));
4761+
DATA(insert OID = 3488 ( gin_triconsistent_jsonbPGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 18 "2281 213802 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_triconsistent_jsonb _null_ _null_ _null_ ));
47624762
DESCR("GIN support");
4763-
DATA(insert OID = 3485 ( gin_extract_jsonb_path PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb_path _null_ _null_ _null_ ));
4763+
DATA(insert OID = 3485 ( gin_extract_jsonb_path PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "3802 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb_path _null_ _null_ _null_ ));
47644764
DESCR("GIN support");
4765-
DATA(insert OID = 3486 ( gin_extract_jsonb_query_pathPGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 2281 "2277 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb_query_path _null_ _null_ _null_ ));
4765+
DATA(insert OID = 3486 ( gin_extract_jsonb_query_pathPGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 2281 "3802 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_jsonb_query_path _null_ _null_ _null_ ));
47664766
DESCR("GIN support");
4767-
DATA(insert OID = 3487 ( gin_consistent_jsonb_path PGNSP PGUID 12 1 0 0 0 f f f f t f i s 8 0 16 "2281 212277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_consistent_jsonb_path _null_ _null_ _null_ ));
4767+
DATA(insert OID = 3487 ( gin_consistent_jsonb_path PGNSP PGUID 12 1 0 0 0 f f f f t f i s 8 0 16 "2281 213802 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_consistent_jsonb_path _null_ _null_ _null_ ));
47684768
DESCR("GIN support");
4769-
DATA(insert OID = 3489 ( gin_triconsistent_jsonb_pathPGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 18 "2281 212277 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_triconsistent_jsonb_path _null_ _null_ _null_ ));
4769+
DATA(insert OID = 3489 ( gin_triconsistent_jsonb_pathPGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 18 "2281 213802 23 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_triconsistent_jsonb_path _null_ _null_ _null_ ));
47704770
DESCR("GIN support");
47714771
DATA(insert OID = 3301 ( jsonb_concat PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3802 "3802 3802" _null_ _null_ _null_ _null_ _null_ jsonb_concat _null_ _null_ _null_ ));
47724772
DATA(insert OID = 3302 ( jsonb_delete PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3802 "3802 25" _null_ _null_ _null_ _null_ _null_ jsonb_delete _null_ _null_ _null_ ));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp