Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f755a15

Browse files
committed
Improve spelling of new FINALFUNC_MODIFY aggregate attribute.
I'd used SHARABLE as a value originally, but Peter Eisentraut points out that dictionaries agree that SHAREABLE is the preferred spelling. Run around and change that before it's too late. Discussion: https://postgr.es/m/d2e1afd4-659c-50d6-1b20-7cfd3675e909@2ndquadrant.com
1 parent 3f5e3a9 commit f755a15

File tree

10 files changed

+37
-36
lines changed

10 files changed

+37
-36
lines changed

doc/src/sgml/ref/create_aggregate.sgml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ CREATE AGGREGATE <replaceable class="parameter">name</replaceable> ( [ <replacea
2727
[ , SSPACE = <replaceable class="parameter">state_data_size</replaceable> ]
2828
[ , FINALFUNC = <replaceable class="parameter">ffunc</replaceable> ]
2929
[ , FINALFUNC_EXTRA ]
30-
[ , FINALFUNC_MODIFY = { READ_ONLY | SHARABLE | READ_WRITE } ]
30+
[ , FINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]
3131
[ , COMBINEFUNC = <replaceable class="parameter">combinefunc</replaceable> ]
3232
[ , SERIALFUNC = <replaceable class="parameter">serialfunc</replaceable> ]
3333
[ , DESERIALFUNC = <replaceable class="parameter">deserialfunc</replaceable> ]
@@ -38,7 +38,7 @@ CREATE AGGREGATE <replaceable class="parameter">name</replaceable> ( [ <replacea
3838
[ , MSSPACE = <replaceable class="parameter">mstate_data_size</replaceable> ]
3939
[ , MFINALFUNC = <replaceable class="parameter">mffunc</replaceable> ]
4040
[ , MFINALFUNC_EXTRA ]
41-
[ , MFINALFUNC_MODIFY = { READ_ONLY | SHARABLE | READ_WRITE } ]
41+
[ , MFINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]
4242
[ , MINITCOND = <replaceable class="parameter">minitial_condition</replaceable> ]
4343
[ , SORTOP = <replaceable class="parameter">sort_operator</replaceable> ]
4444
[ , PARALLEL = { SAFE | RESTRICTED | UNSAFE } ]
@@ -51,7 +51,7 @@ CREATE AGGREGATE <replaceable class="parameter">name</replaceable> ( [ [ <replac
5151
[ , SSPACE = <replaceable class="parameter">state_data_size</replaceable> ]
5252
[ , FINALFUNC = <replaceable class="parameter">ffunc</replaceable> ]
5353
[ , FINALFUNC_EXTRA ]
54-
[ , FINALFUNC_MODIFY = { READ_ONLY | SHARABLE | READ_WRITE } ]
54+
[ , FINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]
5555
[ , INITCOND = <replaceable class="parameter">initial_condition</replaceable> ]
5656
[ , PARALLEL = { SAFE | RESTRICTED | UNSAFE } ]
5757
[ , HYPOTHETICAL ]
@@ -66,7 +66,7 @@ CREATE AGGREGATE <replaceable class="parameter">name</replaceable> (
6666
[ , SSPACE = <replaceable class="parameter">state_data_size</replaceable> ]
6767
[ , FINALFUNC = <replaceable class="parameter">ffunc</replaceable> ]
6868
[ , FINALFUNC_EXTRA ]
69-
[ , FINALFUNC_MODIFY = { READ_ONLY | SHARABLE | READ_WRITE } ]
69+
[ , FINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]
7070
[ , COMBINEFUNC = <replaceable class="parameter">combinefunc</replaceable> ]
7171
[ , SERIALFUNC = <replaceable class="parameter">serialfunc</replaceable> ]
7272
[ , DESERIALFUNC = <replaceable class="parameter">deserialfunc</replaceable> ]
@@ -77,7 +77,7 @@ CREATE AGGREGATE <replaceable class="parameter">name</replaceable> (
7777
[ , MSSPACE = <replaceable class="parameter">mstate_data_size</replaceable> ]
7878
[ , MFINALFUNC = <replaceable class="parameter">mffunc</replaceable> ]
7979
[ , MFINALFUNC_EXTRA ]
80-
[ , MFINALFUNC_MODIFY = { READ_ONLY | SHARABLE | READ_WRITE } ]
80+
[ , MFINALFUNC_MODIFY = { READ_ONLY | SHAREABLE | READ_WRITE } ]
8181
[ , MINITCOND = <replaceable class="parameter">minitial_condition</replaceable> ]
8282
[ , SORTOP = <replaceable class="parameter">sort_operator</replaceable> ]
8383
)
@@ -419,7 +419,7 @@ SELECT col FROM tab ORDER BY col USING sortop LIMIT 1;
419419
</varlistentry>
420420

421421
<varlistentry>
422-
<term><literal>FINALFUNC_MODIFY</literal> = { <literal>READ_ONLY</literal> | <literal>SHARABLE</literal> | <literal>READ_WRITE</literal> }</term>
422+
<term><literal>FINALFUNC_MODIFY</literal> = { <literal>READ_ONLY</literal> | <literal>SHAREABLE</literal> | <literal>READ_WRITE</literal> }</term>
423423
<listitem>
424424
<para>
425425
This option specifies whether the final function is a pure function
@@ -585,7 +585,7 @@ SELECT col FROM tab ORDER BY col USING sortop LIMIT 1;
585585
</varlistentry>
586586

587587
<varlistentry>
588-
<term><literal>MFINALFUNC_MODIFY</literal> = { <literal>READ_ONLY</literal> | <literal>SHARABLE</literal> | <literal>READ_WRITE</literal> }</term>
588+
<term><literal>MFINALFUNC_MODIFY</literal> = { <literal>READ_ONLY</literal> | <literal>SHAREABLE</literal> | <literal>READ_WRITE</literal> }</term>
589589
<listitem>
590590
<para>
591591
This option is like <literal>FINALFUNC_MODIFY</literal>, but it describes
@@ -678,12 +678,13 @@ SELECT col FROM tab ORDER BY col USING sortop LIMIT 1;
678678
Likewise, while an aggregate final function is normally expected not to
679679
modify its input values, sometimes it is impractical to avoid modifying
680680
the transition-state argument. Such behavior must be declared using
681-
the <literal>FINALFUNC_MODIFY</literal> parameter. The <literal>READ_WRITE</literal>
681+
the <literal>FINALFUNC_MODIFY</literal> parameter.
682+
The <literal>READ_WRITE</literal>
682683
value indicates that the final function modifies the transition state in
683684
unspecified ways. This value prevents use of the aggregate as a window
684685
function, and it also prevents merging of transition states for aggregate
685686
calls that share the same input values and transition functions.
686-
The <literal>SHARABLE</literal> value indicates that the transition function
687+
The <literal>SHAREABLE</literal> value indicates that the transition function
687688
cannot be applied after the final function, but multiple final-function
688689
calls can be performed on the ending transition state value. This value
689690
prevents use of the aggregate as a window function, but it allows merging

doc/src/sgml/xaggr.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ SELECT percentile_disc(0.5) WITHIN GROUP (ORDER BY income) FROM households;
491491
to continue adding input rows by executing the transition function again
492492
later. This means the final function is not <literal>READ_ONLY</literal>;
493493
it must be declared in <xref linkend="sql-createaggregate"/>
494-
as <literal>READ_WRITE</literal>, or as <literal>SHARABLE</literal> if it's
495-
possible for additional final-function calls to make use of the
494+
as <literal>READ_WRITE</literal>, or as <literal>SHAREABLE</literal> if
495+
it's possible for additional final-function calls to make use of the
496496
already-sorted state.
497497
</para>
498498

src/backend/commands/aggregatecmds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,13 @@ extractModify(DefElem *defel)
477477

478478
if (strcmp(val, "read_only") == 0)
479479
return AGGMODIFY_READ_ONLY;
480-
if (strcmp(val, "sharable") == 0)
481-
return AGGMODIFY_SHARABLE;
480+
if (strcmp(val, "shareable") == 0)
481+
return AGGMODIFY_SHAREABLE;
482482
if (strcmp(val, "read_write") == 0)
483483
return AGGMODIFY_READ_WRITE;
484484
ereport(ERROR,
485485
(errcode(ERRCODE_SYNTAX_ERROR),
486-
errmsg("parameter \"%s\" must be READ_ONLY, SHARABLE, or READ_WRITE",
486+
errmsg("parameter \"%s\" must be READ_ONLY, SHAREABLE, or READ_WRITE",
487487
defel->defname)));
488488
return 0; /* keep compiler quiet */
489489
}

src/backend/executor/nodeAgg.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static void build_pertrans_for_aggref(AggStatePerTrans pertrans,
288288
static int find_compatible_peragg(Aggref *newagg, AggState *aggstate,
289289
int lastaggno, List **same_input_transnos);
290290
static int find_compatible_pertrans(AggState *aggstate, Aggref *newagg,
291-
bool sharable,
291+
bool shareable,
292292
Oid aggtransfn, Oid aggtranstype,
293293
Oid aggserialfn, Oid aggdeserialfn,
294294
Datum initValue, bool initValueIsNull,
@@ -2522,7 +2522,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
25222522
AclResult aclresult;
25232523
Oid transfn_oid,
25242524
finalfn_oid;
2525-
bool sharable;
2525+
bool shareable;
25262526
Oid serialfn_oid,
25272527
deserialfn_oid;
25282528
Expr *finalfnexpr;
@@ -2597,12 +2597,12 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
25972597

25982598
/*
25992599
* If finalfn is marked read-write, we can't share transition states;
2600-
* but it is okay to share states for AGGMODIFY_SHARABLE aggs. Also,
2600+
* but it is okay to share states for AGGMODIFY_SHAREABLE aggs. Also,
26012601
* if we're not executing the finalfn here, we can share regardless.
26022602
*/
2603-
sharable = (aggform->aggfinalmodify != AGGMODIFY_READ_WRITE) ||
2603+
shareable = (aggform->aggfinalmodify != AGGMODIFY_READ_WRITE) ||
26042604
(finalfn_oid == InvalidOid);
2605-
peragg->sharable = sharable;
2605+
peragg->shareable = shareable;
26062606

26072607
serialfn_oid = InvalidOid;
26082608
deserialfn_oid = InvalidOid;
@@ -2746,12 +2746,12 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
27462746
* 2. Build working state for invoking the transition function, or
27472747
* look up previously initialized working state, if we can share it.
27482748
*
2749-
* find_compatible_peragg() already collected a list of sharable
2749+
* find_compatible_peragg() already collected a list of shareable
27502750
* per-Trans's with the same inputs. Check if any of them have the
27512751
* same transition function and initial value.
27522752
*/
27532753
existing_transno = find_compatible_pertrans(aggstate, aggref,
2754-
sharable,
2754+
shareable,
27552755
transfn_oid, aggtranstype,
27562756
serialfn_oid, deserialfn_oid,
27572757
initValue, initValueIsNull,
@@ -3170,7 +3170,7 @@ GetAggInitVal(Datum textInitVal, Oid transtype)
31703170
* with this one, with the same input parameters. If no compatible aggregate
31713171
* can be found, returns -1.
31723172
*
3173-
* As a side-effect, this also collects a list of existing, sharable per-Trans
3173+
* As a side-effect, this also collects a list of existing, shareable per-Trans
31743174
* structs with matching inputs. If no identical Aggref is found, the list is
31753175
* passed later to find_compatible_pertrans, to see if we can at least reuse
31763176
* the state value of another aggregate.
@@ -3237,7 +3237,7 @@ find_compatible_peragg(Aggref *newagg, AggState *aggstate,
32373237
* we might report a transno more than once. find_compatible_pertrans
32383238
* is cheap enough that it's not worth spending cycles to avoid that.)
32393239
*/
3240-
if (peragg->sharable)
3240+
if (peragg->shareable)
32413241
*same_input_transnos = lappend_int(*same_input_transnos,
32423242
peragg->transno);
32433243
}
@@ -3254,7 +3254,7 @@ find_compatible_peragg(Aggref *newagg, AggState *aggstate,
32543254
* verified to match.)
32553255
*/
32563256
static int
3257-
find_compatible_pertrans(AggState *aggstate, Aggref *newagg, bool sharable,
3257+
find_compatible_pertrans(AggState *aggstate, Aggref *newagg, bool shareable,
32583258
Oid aggtransfn, Oid aggtranstype,
32593259
Oid aggserialfn, Oid aggdeserialfn,
32603260
Datum initValue, bool initValueIsNull,
@@ -3263,7 +3263,7 @@ find_compatible_pertrans(AggState *aggstate, Aggref *newagg, bool sharable,
32633263
ListCell *lc;
32643264

32653265
/* If this aggregate can't share transition states, give up */
3266-
if (!sharable)
3266+
if (!shareable)
32673267
return -1;
32683268

32693269
foreach(lc, transnos)

src/bin/pg_dump/pg_dump.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13833,8 +13833,8 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
1383313833
case AGGMODIFY_READ_ONLY:
1383413834
appendPQExpBufferStr(details, ",\n FINALFUNC_MODIFY = READ_ONLY");
1383513835
break;
13836-
case AGGMODIFY_SHARABLE:
13837-
appendPQExpBufferStr(details, ",\n FINALFUNC_MODIFY = SHARABLE");
13836+
case AGGMODIFY_SHAREABLE:
13837+
appendPQExpBufferStr(details, ",\n FINALFUNC_MODIFY = SHAREABLE");
1383813838
break;
1383913839
case AGGMODIFY_READ_WRITE:
1384013840
appendPQExpBufferStr(details, ",\n FINALFUNC_MODIFY = READ_WRITE");
@@ -13889,8 +13889,8 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
1388913889
case AGGMODIFY_READ_ONLY:
1389013890
appendPQExpBufferStr(details, ",\n MFINALFUNC_MODIFY = READ_ONLY");
1389113891
break;
13892-
case AGGMODIFY_SHARABLE:
13893-
appendPQExpBufferStr(details, ",\n MFINALFUNC_MODIFY = SHARABLE");
13892+
case AGGMODIFY_SHAREABLE:
13893+
appendPQExpBufferStr(details, ",\n MFINALFUNC_MODIFY = SHAREABLE");
1389413894
break;
1389513895
case AGGMODIFY_READ_WRITE:
1389613896
appendPQExpBufferStr(details, ",\n MFINALFUNC_MODIFY = READ_WRITE");

src/bin/pg_dump/t/002_pg_dump.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@
14311431
basetype = int4,
14321432
stype = _int8,
14331433
finalfunc = int8_avg,
1434-
finalfunc_modify = sharable,
1434+
finalfunc_modify = shareable,
14351435
initcond1 = \'{0,0}\'
14361436
);',
14371437
regexp => qr/^
@@ -1440,7 +1440,7 @@
14401440
\n\s+\QSTYPE = bigint[],\E
14411441
\n\s+\QINITCOND = '{0,0}',\E
14421442
\n\s+\QFINALFUNC = int8_avg,\E
1443-
\n\s+\QFINALFUNC_MODIFY = SHARABLE\E
1443+
\n\s+\QFINALFUNC_MODIFY = SHAREABLE\E
14441444
\n\);/xm,
14451445
like => {
14461446
%full_runs,

src/include/catalog/pg_aggregate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ typedef FormData_pg_aggregate *Form_pg_aggregate;
134134
* transfn cannot be applied anymore after the first finalfn call.
135135
*/
136136
#define AGGMODIFY_READ_ONLY 'r'
137-
#define AGGMODIFY_SHARABLE 's'
137+
#define AGGMODIFY_SHAREABLE 's'
138138
#define AGGMODIFY_READ_WRITE 'w'
139139

140140
#endif /* EXPOSE_TO_CLIENT_CODE */

src/include/executor/nodeAgg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ typedef struct AggStatePerAggData
216216
bool resulttypeByVal;
217217

218218
/*
219-
* "sharable" is false if this agg cannot share state values with other
219+
* "shareable" is false if this agg cannot share state values with other
220220
* aggregates because the final function is read-write.
221221
*/
222-
bool sharable;
222+
bool shareable;
223223
} AggStatePerAggData;
224224

225225
/*

src/test/regress/expected/create_aggregate.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ CREATE AGGREGATE myavg (numeric)
148148
serialfunc = numeric_avg_serialize,
149149
deserialfunc = numeric_avg_deserialize,
150150
combinefunc = numeric_avg_combine,
151-
finalfunc_modify = sharable -- just to test a non-default setting
151+
finalfunc_modify = shareable -- just to test a non-default setting
152152
);
153153
-- Ensure all these functions made it into the catalog
154154
SELECT aggfnoid, aggtransfn, aggcombinefn, aggtranstype::regtype,

src/test/regress/sql/create_aggregate.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ CREATE AGGREGATE myavg (numeric)
163163
serialfunc = numeric_avg_serialize,
164164
deserialfunc = numeric_avg_deserialize,
165165
combinefunc = numeric_avg_combine,
166-
finalfunc_modify = sharable -- just to test a non-default setting
166+
finalfunc_modify = shareable -- just to test a non-default setting
167167
);
168168

169169
-- Ensure all these functions made it into the catalog

0 commit comments

Comments
 (0)