@@ -191,58 +191,6 @@ static relopt_int intRelOpts[] =
191
191
},
192
192
-1 , 1 , 10000
193
193
},
194
- {
195
- {
196
- "autovacuum_freeze_min_age" ,
197
- "Minimum age at which VACUUM should freeze a table row, for autovacuum" ,
198
- RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
199
- ShareUpdateExclusiveLock
200
- },
201
- -1 , 0 , 1000000000
202
- },
203
- {
204
- {
205
- "autovacuum_multixact_freeze_min_age" ,
206
- "Minimum multixact age at which VACUUM should freeze a row multixact's, for autovacuum" ,
207
- RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
208
- ShareUpdateExclusiveLock
209
- },
210
- -1 , 0 , 1000000000
211
- },
212
- {
213
- {
214
- "autovacuum_freeze_max_age" ,
215
- "Age at which to autovacuum a table to prevent transaction ID wraparound" ,
216
- RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
217
- ShareUpdateExclusiveLock
218
- },
219
- -1 , 100000 , 2000000000
220
- },
221
- {
222
- {
223
- "autovacuum_multixact_freeze_max_age" ,
224
- "Multixact age at which to autovacuum a table to prevent multixact wraparound" ,
225
- RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
226
- ShareUpdateExclusiveLock
227
- },
228
- -1 , 10000 , 2000000000
229
- },
230
- {
231
- {
232
- "autovacuum_freeze_table_age" ,
233
- "Age at which VACUUM should perform a full table sweep to freeze row versions" ,
234
- RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
235
- ShareUpdateExclusiveLock
236
- }, -1 , 0 , 2000000000
237
- },
238
- {
239
- {
240
- "autovacuum_multixact_freeze_table_age" ,
241
- "Age of multixact at which VACUUM should perform a full table sweep to freeze row versions" ,
242
- RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
243
- ShareUpdateExclusiveLock
244
- }, -1 , 0 , 2000000000
245
- },
246
194
{
247
195
{
248
196
"log_autovacuum_min_duration" ,
@@ -291,7 +239,66 @@ static relopt_int intRelOpts[] =
291
239
},
292
240
-1 , 0 , 1024
293
241
},
242
+ /* list terminator */
243
+ {{NULL }}
244
+ };
294
245
246
+ static relopt_int64 int64RelOpts [] =
247
+ {
248
+ {
249
+ {
250
+ "autovacuum_freeze_min_age" ,
251
+ "Minimum age at which VACUUM should freeze a table row, for autovacuum" ,
252
+ RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
253
+ ShareUpdateExclusiveLock
254
+ },
255
+ INT64CONST (-1 ), INT64CONST (0 ), INT64CONST (1000000000 )
256
+ },
257
+ {
258
+ {
259
+ "autovacuum_multixact_freeze_min_age" ,
260
+ "Minimum multixact age at which VACUUM should freeze a row multixact's, for autovacuum" ,
261
+ RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
262
+ ShareUpdateExclusiveLock
263
+ },
264
+ INT64CONST (-1 ), INT64CONST (0 ), INT64CONST (1000000000 )
265
+ },
266
+ {
267
+ {
268
+ "autovacuum_freeze_max_age" ,
269
+ "Age at which to autovacuum a table to prevent transaction ID wraparound" ,
270
+ RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
271
+ ShareUpdateExclusiveLock
272
+ },
273
+ INT64CONST (-1 ), INT64CONST (100000 ), INT64CONST (2000000000 )
274
+ },
275
+ {
276
+ {
277
+ "autovacuum_multixact_freeze_max_age" ,
278
+ "Multixact age at which to autovacuum a table to prevent multixact wraparound" ,
279
+ RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
280
+ ShareUpdateExclusiveLock
281
+ },
282
+ INT64CONST (-1 ), INT64CONST (10000 ), INT64CONST (2000000000 )
283
+ },
284
+ {
285
+ {
286
+ "autovacuum_freeze_table_age" ,
287
+ "Age at which VACUUM should perform a full table sweep to freeze row versions" ,
288
+ RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
289
+ ShareUpdateExclusiveLock
290
+ },
291
+ INT64CONST (-1 ), INT64CONST (0 ), INT64CONST (2000000000 )
292
+ },
293
+ {
294
+ {
295
+ "autovacuum_multixact_freeze_table_age" ,
296
+ "Age of multixact at which VACUUM should perform a full table sweep to freeze row versions" ,
297
+ RELOPT_KIND_HEAP | RELOPT_KIND_TOAST ,
298
+ ShareUpdateExclusiveLock
299
+ },
300
+ INT64CONST (-1 ), INT64CONST (0 ), INT64CONST (2000000000 )
301
+ },
295
302
/* list terminator */
296
303
{{NULL }}
297
304
};
@@ -458,6 +465,14 @@ initialize_reloptions(void)
458
465
j ++ ;
459
466
}
460
467
468
+ for (i = 0 ; int64RelOpts [i ].gen .name ; i ++ )
469
+ {
470
+ relOpts [j ] = & int64RelOpts [i ].gen ;
471
+ relOpts [j ]-> type = RELOPT_TYPE_INT64 ;
472
+ relOpts [j ]-> namelen = strlen (relOpts [j ]-> name );
473
+ j ++ ;
474
+ }
475
+
461
476
for (i = 0 ; realRelOpts [i ].gen .name ; i ++ )
462
477
{
463
478
relOpts [j ] = & realRelOpts [i ].gen ;
@@ -560,6 +575,9 @@ allocate_reloption(bits32 kinds, int type, char *name, char *desc)
560
575
case RELOPT_TYPE_INT :
561
576
size = sizeof (relopt_int );
562
577
break ;
578
+ case RELOPT_TYPE_INT64 :
579
+ size = sizeof (relopt_int64 );
580
+ break ;
563
581
case RELOPT_TYPE_REAL :
564
582
size = sizeof (relopt_real );
565
583
break ;
@@ -622,6 +640,25 @@ add_int_reloption(bits32 kinds, char *name, char *desc, int default_val,
622
640
add_reloption ((relopt_gen * ) newoption );
623
641
}
624
642
643
+ /*
644
+ * add_int64_reloption
645
+ * Add a new integer reloption
646
+ */
647
+ void
648
+ add_int64_reloption (bits32 kinds , char * name , char * desc , int64 default_val ,
649
+ int64 min_val , int64 max_val )
650
+ {
651
+ relopt_int64 * newoption ;
652
+
653
+ newoption = (relopt_int64 * ) allocate_reloption (kinds , RELOPT_TYPE_INT64 ,
654
+ name , desc );
655
+ newoption -> default_val = default_val ;
656
+ newoption -> min = min_val ;
657
+ newoption -> max = max_val ;
658
+
659
+ add_reloption ((relopt_gen * ) newoption );
660
+ }
661
+
625
662
/*
626
663
* add_real_reloption
627
664
* Add a new float reloption
@@ -1126,6 +1163,27 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len,
1126
1163
optint -> min , optint -> max )));
1127
1164
}
1128
1165
break ;
1166
+ case RELOPT_TYPE_INT64 :
1167
+ {
1168
+ relopt_int64 * optint = (relopt_int64 * ) option -> gen ;
1169
+
1170
+ parsed = parse_int64 (value , & option -> values .int64_val , 0 , NULL );
1171
+ if (validate && !parsed )
1172
+ ereport (ERROR ,
1173
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
1174
+ errmsg ("invalid value for integer option \"%s\": %s" ,
1175
+ option -> gen -> name , value )));
1176
+ if (validate && (option -> values .int64_val < optint -> min ||
1177
+ option -> values .int64_val > optint -> max ))
1178
+ ereport (ERROR ,
1179
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
1180
+ errmsg ("value %s out of bounds for option \"%s\"" ,
1181
+ value , option -> gen -> name ),
1182
+ errdetail ("Valid values are between \"" INT64_FORMAT
1183
+ "\" and \"" INT64_FORMAT "\"." ,
1184
+ optint -> min , optint -> max )));
1185
+ }
1186
+ break ;
1129
1187
case RELOPT_TYPE_REAL :
1130
1188
{
1131
1189
relopt_real * optreal = (relopt_real * ) option -> gen ;
@@ -1234,6 +1292,11 @@ fillRelOptions(void *rdopts, Size basesize,
1234
1292
options [i ].values .int_val :
1235
1293
((relopt_int * ) options [i ].gen )-> default_val ;
1236
1294
break ;
1295
+ case RELOPT_TYPE_INT64 :
1296
+ * (int64 * ) itempos = options [i ].isset ?
1297
+ options [i ].values .int64_val :
1298
+ ((relopt_int64 * ) options [i ].gen )-> default_val ;
1299
+ break ;
1237
1300
case RELOPT_TYPE_REAL :
1238
1301
* (double * ) itempos = options [i ].isset ?
1239
1302
options [i ].values .real_val :
@@ -1295,17 +1358,17 @@ default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
1295
1358
offsetof(StdRdOptions , autovacuum ) + offsetof(AutoVacOpts , vacuum_cost_delay )},
1296
1359
{"autovacuum_vacuum_cost_limit" , RELOPT_TYPE_INT ,
1297
1360
offsetof(StdRdOptions , autovacuum ) + offsetof(AutoVacOpts , vacuum_cost_limit )},
1298
- {"autovacuum_freeze_min_age" , RELOPT_TYPE_INT ,
1361
+ {"autovacuum_freeze_min_age" , RELOPT_TYPE_INT64 ,
1299
1362
offsetof(StdRdOptions , autovacuum ) + offsetof(AutoVacOpts , freeze_min_age )},
1300
- {"autovacuum_freeze_max_age" , RELOPT_TYPE_INT ,
1363
+ {"autovacuum_freeze_max_age" , RELOPT_TYPE_INT64 ,
1301
1364
offsetof(StdRdOptions , autovacuum ) + offsetof(AutoVacOpts , freeze_max_age )},
1302
- {"autovacuum_freeze_table_age" , RELOPT_TYPE_INT ,
1365
+ {"autovacuum_freeze_table_age" , RELOPT_TYPE_INT64 ,
1303
1366
offsetof(StdRdOptions , autovacuum ) + offsetof(AutoVacOpts , freeze_table_age )},
1304
- {"autovacuum_multixact_freeze_min_age" , RELOPT_TYPE_INT ,
1367
+ {"autovacuum_multixact_freeze_min_age" , RELOPT_TYPE_INT64 ,
1305
1368
offsetof(StdRdOptions , autovacuum ) + offsetof(AutoVacOpts , multixact_freeze_min_age )},
1306
- {"autovacuum_multixact_freeze_max_age" , RELOPT_TYPE_INT ,
1369
+ {"autovacuum_multixact_freeze_max_age" , RELOPT_TYPE_INT64 ,
1307
1370
offsetof(StdRdOptions , autovacuum ) + offsetof(AutoVacOpts , multixact_freeze_max_age )},
1308
- {"autovacuum_multixact_freeze_table_age" , RELOPT_TYPE_INT ,
1371
+ {"autovacuum_multixact_freeze_table_age" , RELOPT_TYPE_INT64 ,
1309
1372
offsetof(StdRdOptions , autovacuum ) + offsetof(AutoVacOpts , multixact_freeze_table_age )},
1310
1373
{"log_autovacuum_min_duration" , RELOPT_TYPE_INT ,
1311
1374
offsetof(StdRdOptions , autovacuum ) + offsetof(AutoVacOpts , log_min_duration )},
0 commit comments