Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 657c289

Browse files
committedNov 4, 2017
Including patch
1 parent a9169f0 commit 657c289

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1532
-370
lines changed
 

‎contrib/bloom/blutils.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ blhandler(PG_FUNCTION_ARGS)
120120
amroutine->amclusterable = false;
121121
amroutine->ampredlocks = false;
122122
amroutine->amcanparallel = false;
123+
amroutine->amcaninclude = false;
123124
amroutine->amkeytype = InvalidOid;
124125

125126
amroutine->ambuild = blbuild;

‎contrib/dblink/dblink.c‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static remoteConn *getConnectionByName(const char *name);
100100
static HTAB *createConnHash(void);
101101
static void createNewConnection(const char *name, remoteConn *rconn);
102102
static void deleteConnection(const char *name);
103-
static char **get_pkey_attnames(Relation rel, int16 *numatts);
103+
static char **get_pkey_attnames(Relation rel, int16 *indnkeyatts);
104104
static char **get_text_array_contents(ArrayType *array, int *numitems);
105105
static char *get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals, char **tgt_pkattvals);
106106
static char *get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals);
@@ -1491,7 +1491,7 @@ PG_FUNCTION_INFO_V1(dblink_get_pkey);
14911491
Datum
14921492
dblink_get_pkey(PG_FUNCTION_ARGS)
14931493
{
1494-
int16 numatts;
1494+
int16 indnkeyatts;
14951495
char **results;
14961496
FuncCallContext *funcctx;
14971497
int32 call_cntr;
@@ -1517,7 +1517,7 @@ dblink_get_pkey(PG_FUNCTION_ARGS)
15171517
rel = get_rel_from_relname(PG_GETARG_TEXT_PP(0), AccessShareLock, ACL_SELECT);
15181518

15191519
/* get the array of attnums */
1520-
results = get_pkey_attnames(rel, &numatts);
1520+
results = get_pkey_attnames(rel, &indnkeyatts);
15211521

15221522
relation_close(rel, AccessShareLock);
15231523

@@ -1537,9 +1537,9 @@ dblink_get_pkey(PG_FUNCTION_ARGS)
15371537
attinmeta = TupleDescGetAttInMetadata(tupdesc);
15381538
funcctx->attinmeta = attinmeta;
15391539

1540-
if ((results != NULL) && (numatts > 0))
1540+
if ((results != NULL) && (indnkeyatts > 0))
15411541
{
1542-
funcctx->max_calls = numatts;
1542+
funcctx->max_calls = indnkeyatts;
15431543

15441544
/* got results, keep track of them */
15451545
funcctx->user_fctx = results;
@@ -2027,10 +2027,10 @@ dblink_fdw_validator(PG_FUNCTION_ARGS)
20272027
* get_pkey_attnames
20282028
*
20292029
* Get the primary key attnames for the given relation.
2030-
* Return NULL, and set numatts = 0, if no primary key exists.
2030+
* Return NULL, and set indnkeyatts = 0, if no primary key exists.
20312031
*/
20322032
static char **
2033-
get_pkey_attnames(Relation rel, int16 *numatts)
2033+
get_pkey_attnames(Relation rel, int16 *indnkeyatts)
20342034
{
20352035
Relation indexRelation;
20362036
ScanKeyData skey;
@@ -2040,8 +2040,8 @@ get_pkey_attnames(Relation rel, int16 *numatts)
20402040
char **result = NULL;
20412041
TupleDesc tupdesc;
20422042

2043-
/* initialize numatts to 0 in case no primary key exists */
2044-
*numatts = 0;
2043+
/* initialize indnkeyatts to 0 in case no primary key exists */
2044+
*indnkeyatts = 0;
20452045

20462046
tupdesc = rel->rd_att;
20472047

@@ -2062,12 +2062,12 @@ get_pkey_attnames(Relation rel, int16 *numatts)
20622062
/* we're only interested if it is the primary key */
20632063
if (index->indisprimary)
20642064
{
2065-
*numatts = index->indnatts;
2066-
if (*numatts > 0)
2065+
*indnkeyatts = index->indnkeyatts;
2066+
if (*indnkeyatts > 0)
20672067
{
2068-
result = (char **) palloc(*numatts * sizeof(char *));
2068+
result = (char **) palloc(*indnkeyatts * sizeof(char *));
20692069

2070-
for (i = 0; i < *numatts; i++)
2070+
for (i = 0; i < *indnkeyatts; i++)
20712071
result[i] = SPI_fname(tupdesc, index->indkey.values[i]);
20722072
}
20732073
break;

‎contrib/tcn/tcn.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ triggered_change_notification(PG_FUNCTION_ARGS)
138138
/* we're only interested if it is the primary key and valid */
139139
if (index->indisprimary && IndexIsValid(index))
140140
{
141-
int numatts = index->indnatts;
141+
int indnkeyatts = index->indnkeyatts;
142142

143-
if (numatts > 0)
143+
if (indnkeyatts > 0)
144144
{
145145
int i;
146146

@@ -150,7 +150,7 @@ triggered_change_notification(PG_FUNCTION_ARGS)
150150
appendStringInfoCharMacro(payload, ',');
151151
appendStringInfoCharMacro(payload, operation);
152152

153-
for (i = 0; i < numatts; i++)
153+
for (i = 0; i < indnkeyatts; i++)
154154
{
155155
int colno = index->indkey.values[i];
156156
Form_pg_attribute attr = TupleDescAttr(tupdesc, colno - 1);

‎doc/src/sgml/catalogs.sgml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3686,6 +3686,14 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
36863686
<literal>pg_class.relnatts</literal>)</entry>
36873687
</row>
36883688

3689+
<row>
3690+
<entry><structfield>indnkeyatts</structfield></entry>
3691+
<entry><type>int2</type></entry>
3692+
<entry></entry>
3693+
<entry>The number of key columns in the index. "Key columns" are ordinary
3694+
index columns (as opposed to "included" columns).</entry>
3695+
</row>
3696+
36893697
<row>
36903698
<entry><structfield>indisunique</structfield></entry>
36913699
<entry><type>bool</type></entry>

0 commit comments

Comments
 (0)
Please sign in to comment.