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

Commit7e2f906

Browse files
committed
Remove pg_am.amindexnulls.
The only use we have had for amindexnulls is in determining whether anindex is safe to cluster on; but since the addition of the amclusterableflag, that usage is pretty redundant.In passing, clean up assorted sloppiness from the last patch that touchedpg_am.h: Natts_pg_am was wrong, and ambuildempty was not documented.
1 parent56a5747 commit7e2f906

File tree

5 files changed

+35
-76
lines changed

5 files changed

+35
-76
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,6 @@
469469
for the first index column?</entry>
470470
</row>
471471

472-
<row>
473-
<entry><structfield>amindexnulls</structfield></entry>
474-
<entry><type>bool</type></entry>
475-
<entry></entry>
476-
<entry>Does the access method support null index entries?</entry>
477-
</row>
478-
479472
<row>
480473
<entry><structfield>amsearchnulls</structfield></entry>
481474
<entry><type>bool</type></entry>
@@ -567,6 +560,13 @@
567560
<entry><quote>Build new index</quote> function</entry>
568561
</row>
569562

563+
<row>
564+
<entry><structfield>ambuildempty</structfield></entry>
565+
<entry><type>regproc</type></entry>
566+
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
567+
<entry><quote>Build empty index</quote> function</entry>
568+
</row>
569+
570570
<row>
571571
<entry><structfield>ambulkdelete</structfield></entry>
572572
<entry><type>regproc</type></entry>

‎doc/src/sgml/indexam.sgml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,15 @@
105105
where no indexable restriction clause is given for the first index column.
106106
When <structfield>amcanmulticol</structfield> is false,
107107
<structfield>amoptionalkey</structfield> essentially says whether the
108-
access methodallows full-index scans without any restriction clause.
108+
access methodsupports full-index scans without any restriction clause.
109109
Access methods that support multiple index columns <emphasis>must</>
110110
support scans that omit restrictions on any or all of the columns after
111111
the first; however they are permitted to require some restriction to
112112
appear for the first index column, and this is signaled by setting
113113
<structfield>amoptionalkey</structfield> false.
114-
<structfield>amindexnulls</structfield> asserts that index entries are
115-
created for NULL key values. Since most indexable operators are
114+
One reason that an index AM might set
115+
<structfield>amoptionalkey</structfield> false is if it doesn't index
116+
NULLs. Since most indexable operators are
116117
strict and hence cannot return TRUE for NULL inputs,
117118
it is at first sight attractive to not store index entries for null values:
118119
they could never be returned by an index scan anyway. However, this
@@ -129,10 +130,7 @@
129130
used to scan for rows with <literal>a = 4</literal>, which is wrong if the
130131
index omits rows where <literal>b</> is null.
131132
It is, however, OK to omit rows where the first indexed column is null.
132-
Thus, <structfield>amindexnulls</structfield> should be set true only if the
133-
index access method indexes all rows, including arbitrary combinations of
134-
null values. An index access method that sets
135-
<structfield>amindexnulls</structfield> may also set
133+
An index access method that does index nulls may also set
136134
<structfield>amsearchnulls</structfield>, indicating that it supports
137135
<literal>IS NULL</> and <literal>IS NOT NULL</> clauses as search
138136
conditions.

‎src/backend/commands/cluster.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -436,43 +436,6 @@ check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMOD
436436
errmsg("cannot cluster on partial index \"%s\"",
437437
RelationGetRelationName(OldIndex))));
438438

439-
if (!OldIndex->rd_am->amindexnulls)
440-
{
441-
AttrNumbercolno;
442-
443-
/*
444-
* If the AM doesn't index nulls, then it's a partial index unless we
445-
* can prove all the rows are non-null. Note we only need look at the
446-
* first column; multicolumn-capable AMs are *required* to index nulls
447-
* in columns after the first.
448-
*/
449-
colno=OldIndex->rd_index->indkey.values[0];
450-
if (colno>0)
451-
{
452-
/* ordinary user attribute */
453-
if (!OldHeap->rd_att->attrs[colno-1]->attnotnull)
454-
ereport(ERROR,
455-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
456-
errmsg("cannot cluster on index \"%s\" because access method does not handle null values",
457-
RelationGetRelationName(OldIndex)),
458-
recheck
459-
?errhint("You might be able to work around this by marking column \"%s\" NOT NULL, or use ALTER TABLE ... SET WITHOUT CLUSTER to remove the cluster specification from the table.",
460-
NameStr(OldHeap->rd_att->attrs[colno-1]->attname))
461-
:errhint("You might be able to work around this by marking column \"%s\" NOT NULL.",
462-
NameStr(OldHeap->rd_att->attrs[colno-1]->attname))));
463-
}
464-
elseif (colno<0)
465-
{
466-
/* system column --- okay, always non-null */
467-
}
468-
else
469-
/* index expression, lose... */
470-
ereport(ERROR,
471-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
472-
errmsg("cannot cluster on expressional index \"%s\" because its index access method does not handle null values",
473-
RelationGetRelationName(OldIndex))));
474-
}
475-
476439
/*
477440
* Disallow if index is left over from a failed CREATE INDEX CONCURRENTLY;
478441
* it might well not contain entries for every heap row, or might not even

‎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_NO201101071
56+
#defineCATALOG_VERSION_NO201101081
5757

5858
#endif

‎src/include/catalog/pg_am.h

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ CATALOG(pg_am,2601)
4646
boolamcanunique;/* does AM support UNIQUE indexes? */
4747
boolamcanmulticol;/* does AM support multi-column indexes? */
4848
boolamoptionalkey;/* can query omit key for the first column? */
49-
boolamindexnulls;/* does AM support NULL index entries? */
5049
boolamsearchnulls;/* can AM search for NULL/NOT NULL entries? */
5150
boolamstorage;/* can storage type differ from column type? */
5251
boolamclusterable;/* does AM support cluster command? */
@@ -88,41 +87,40 @@ typedef FormData_pg_am *Form_pg_am;
8887
#defineAnum_pg_am_amcanunique7
8988
#defineAnum_pg_am_amcanmulticol8
9089
#defineAnum_pg_am_amoptionalkey9
91-
#defineAnum_pg_am_amindexnulls10
92-
#defineAnum_pg_am_amsearchnulls11
93-
#defineAnum_pg_am_amstorage12
94-
#defineAnum_pg_am_amclusterable13
95-
#defineAnum_pg_am_amkeytype14
96-
#defineAnum_pg_am_aminsert15
97-
#defineAnum_pg_am_ambeginscan16
98-
#defineAnum_pg_am_amgettuple17
99-
#defineAnum_pg_am_amgetbitmap18
100-
#defineAnum_pg_am_amrescan19
101-
#defineAnum_pg_am_amendscan20
102-
#defineAnum_pg_am_ammarkpos21
103-
#defineAnum_pg_am_amrestrpos22
104-
#defineAnum_pg_am_ambuild23
105-
#defineAnum_pg_am_ambuildempty24
106-
#defineAnum_pg_am_ambulkdelete25
107-
#defineAnum_pg_am_amvacuumcleanup26
108-
#defineAnum_pg_am_amcostestimate27
109-
#defineAnum_pg_am_amoptions28
90+
#defineAnum_pg_am_amsearchnulls10
91+
#defineAnum_pg_am_amstorage11
92+
#defineAnum_pg_am_amclusterable12
93+
#defineAnum_pg_am_amkeytype13
94+
#defineAnum_pg_am_aminsert14
95+
#defineAnum_pg_am_ambeginscan15
96+
#defineAnum_pg_am_amgettuple16
97+
#defineAnum_pg_am_amgetbitmap17
98+
#defineAnum_pg_am_amrescan18
99+
#defineAnum_pg_am_amendscan19
100+
#defineAnum_pg_am_ammarkpos20
101+
#defineAnum_pg_am_amrestrpos21
102+
#defineAnum_pg_am_ambuild22
103+
#defineAnum_pg_am_ambuildempty23
104+
#defineAnum_pg_am_ambulkdelete24
105+
#defineAnum_pg_am_amvacuumcleanup25
106+
#defineAnum_pg_am_amcostestimate26
107+
#defineAnum_pg_am_amoptions27
110108

111109
/* ----------------
112110
*initial contents of pg_am
113111
* ----------------
114112
*/
115113

116-
DATA(insertOID=403 (btree51tfttttttft0btinsertbtbeginscanbtgettuplebtgetbitmapbtrescanbtendscanbtmarkposbtrestrposbtbuildbtbuildemptybtbulkdeletebtvacuumcleanupbtcostestimatebtoptions ));
114+
DATA(insertOID=403 (btree51tftttttft0btinsertbtbeginscanbtgettuplebtgetbitmapbtrescanbtendscanbtmarkposbtrestrposbtbuildbtbuildemptybtbulkdeletebtvacuumcleanupbtcostestimatebtoptions ));
117115
DESCR("b-tree index access method");
118116
#defineBTREE_AM_OID 403
119-
DATA(insertOID=405 (hash11fftfffffff23hashinserthashbeginscanhashgettuplehashgetbitmaphashrescanhashendscanhashmarkposhashrestrposhashbuildhashbuildemptyhashbulkdeletehashvacuumcleanuphashcostestimatehashoptions ));
117+
DATA(insertOID=405 (hash11fftffffff23hashinserthashbeginscanhashgettuplehashgetbitmaphashrescanhashendscanhashmarkposhashrestrposhashbuildhashbuildemptyhashbulkdeletehashvacuumcleanuphashcostestimatehashoptions ));
120118
DESCR("hash index access method");
121119
#defineHASH_AM_OID 405
122-
DATA(insertOID=783 (gist08ftfftttttt0gistinsertgistbeginscangistgettuplegistgetbitmapgistrescangistendscangistmarkposgistrestrposgistbuildgistbuildemptygistbulkdeletegistvacuumcleanupgistcostestimategistoptions ));
120+
DATA(insertOID=783 (gist08ftffttttt0gistinsertgistbeginscangistgettuplegistgetbitmapgistrescangistendscangistmarkposgistrestrposgistbuildgistbuildemptygistbulkdeletegistvacuumcleanupgistcostestimategistoptions ));
123121
DESCR("GiST index access method");
124122
#defineGIST_AM_OID 783
125-
DATA(insertOID=2742 (gin05ffffttfftf0gininsertginbeginscan-gingetbitmapginrescanginendscanginmarkposginrestrposginbuildginbuildemptyginbulkdeleteginvacuumcleanupgincostestimateginoptions ));
123+
DATA(insertOID=2742 (gin05ffffttftf0gininsertginbeginscan-gingetbitmapginrescanginendscanginmarkposginrestrposginbuildginbuildemptyginbulkdeleteginvacuumcleanupgincostestimateginoptions ));
126124
DESCR("GIN index access method");
127125
#defineGIN_AM_OID 2742
128126

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp