1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-19 23:22:23 +03:00

Use fork names instead of numbers in the file names for additional

relation forks. While the file names are not visible to users, for those
that do peek into the data directory, it's nice to have more descriptive
names. Per Greg Stark's suggestion.
This commit is contained in:
Heikki Linnakangas
2008-10-06 14:13:17 +00:00
parent e59ad5fbb6
commit 5f853c6556
9 changed files with 67 additions and 64 deletions

View File

@@ -5,7 +5,7 @@
* Copyright (c) 2002-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.21 2008/10/03 07:33:09 heikki Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.22 2008/10/06 14:13:17 heikki Exp $
*
*/
@@ -283,35 +283,6 @@ calculate_relation_size(RelFileNode *rfn, ForkNumber forknum)
return totalsize;
}
/*
* XXX: Consider making this global and moving elsewhere. But currently
* there's no other users for this.
*
* Remember to also update the errhint below if you add entries, and the
* documentation for pg_relation_size().
*/
static char *forkNames[] = {
"main", /* MAIN_FORKNUM */
"fsm" /* FSM_FORKNUM */
};
static ForkNumber
forkname_to_number(char *forkName)
{
ForkNumber forkNum;
for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++)
if (strcmp(forkNames[forkNum], forkName) == 0)
return forkNum;
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid fork name"),
errhint("Valid fork names are 'main' and 'fsm'")));
return InvalidForkNumber; /* keep compiler quiet */
}
Datum
pg_relation_size(PG_FUNCTION_ARGS)
{