mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
Allow pg_set_relation_stats() to set relpages to -1.
While the default value for relpages is 0, if a partitioned table with at least one child has been analyzed, then the partititoned table will have a relpages value of -1. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=fajh1Lpcyr_XsMmq-9Z=SGk-u+_Zeac7Pt0RAN3uiVCg@mail.gmail.com
This commit is contained in:
@@ -99,11 +99,16 @@ relation_statistics_update(FunctionCallInfo fcinfo, int elevel)
|
||||
{
|
||||
int32 relpages = PG_GETARG_INT32(RELPAGES_ARG);
|
||||
|
||||
if (relpages < 0)
|
||||
/*
|
||||
* Partitioned tables may have relpages=-1. Note: for relations with
|
||||
* no storage, relpages=-1 is not used consistently, but must be
|
||||
* supported here.
|
||||
*/
|
||||
if (relpages < -1)
|
||||
{
|
||||
ereport(elevel,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("relpages cannot be < 0")));
|
||||
errmsg("relpages cannot be < -1")));
|
||||
table_close(crel, RowExclusiveLock);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user