summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorHeikki Linnakangas2008-10-03 07:33:10 +0000
committerHeikki Linnakangas2008-10-03 07:33:10 +0000
commit706a308806a066017c63024c454bb02953c9822c (patch)
tree4c763cb1f96c4b89caec213c123bdc5b910991bd /src/include
parent2cc1633a35a57fe2c2670c43691ab9ffa582f3ff (diff)
Add relation fork support to pg_relation_size() function. You can now pass
name of a fork ('main' or 'fsm', at the moment) to pg_relation_size() to get the size of a specific fork. Defaults to 'main', if none given. While we're at it, modify pg_relation_size to take a regclass as argument, instead of separate variants taking oid and name. This change is transparent to typical use where the table name is passed as a string literal, like pg_relation_size('table'), but will break queries like pg_relation_size(namecol), where namecol is of type name. text-type input still works, and using a non-schema-qualified table name is not very reliable anyway, so this is unlikely to break anyone's queries in practice.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/pg_proc.h12
-rw-r--r--src/include/storage/relfilenode.h7
-rw-r--r--src/include/utils/builtins.h8
4 files changed, 15 insertions, 16 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 99b90624d6a..e333b6d6d68 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.490 2008/09/30 11:11:28 heikki Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.491 2008/10/03 07:33:09 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200809301
+#define CATALOG_VERSION_NO 200810031
#endif
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 42d8ce7fe80..2b3de5ece1b 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.515 2008/09/19 19:03:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.516 2008/10/03 07:33:09 heikki Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -3591,13 +3591,11 @@ DATA(insert OID = 2324 ( pg_database_size PGNSP PGUID 12 1 0 0 f f t f v 1 20 "
DESCR("total disk space usage for the specified database");
DATA(insert OID = 2168 ( pg_database_size PGNSP PGUID 12 1 0 0 f f t f v 1 20 "19" _null_ _null_ _null_ pg_database_size_name _null_ _null_ _null_ ));
DESCR("total disk space usage for the specified database");
-DATA(insert OID = 2325 ( pg_relation_size PGNSP PGUID 12 1 0 0 f f t f v 1 20 "26" _null_ _null_ _null_ pg_relation_size_oid _null_ _null_ _null_ ));
+DATA(insert OID = 2325 ( pg_relation_size PGNSP PGUID 14 1 0 0 f f t f v 1 20 "2205" _null_ _null_ _null_ "select pg_catalog.pg_relation_size($1, ''main'')" _null_ _null_ _null_ ));
DESCR("disk space usage for the specified table or index");
-DATA(insert OID = 2289 ( pg_relation_size PGNSP PGUID 12 1 0 0 f f t f v 1 20 "25" _null_ _null_ _null_ pg_relation_size_name _null_ _null_ _null_ ));
-DESCR("disk space usage for the specified table or index");
-DATA(insert OID = 2286 ( pg_total_relation_size PGNSP PGUID 12 1 0 0 f f t f v 1 20 "26" _null_ _null_ _null_ pg_total_relation_size_oid _null_ _null_ _null_ ));
-DESCR("total disk space usage for the specified table and associated indexes and toast tables");
-DATA(insert OID = 2287 ( pg_total_relation_size PGNSP PGUID 12 1 0 0 f f t f v 1 20 "25" _null_ _null_ _null_ pg_total_relation_size_name _null_ _null_ _null_ ));
+DATA(insert OID = 2332 ( pg_relation_size PGNSP PGUID 12 1 0 0 f f t f v 2 20 "2205 25" _null_ _null_ _null_ pg_relation_size _null_ _null_ _null_ ));
+DESCR("disk space usage for the specified fork of a table or index");
+DATA(insert OID = 2286 ( pg_total_relation_size PGNSP PGUID 12 1 0 0 f f t f v 1 20 "2205" _null_ _null_ _null_ pg_total_relation_size _null_ _null_ _null_ ));
DESCR("total disk space usage for the specified table and associated indexes and toast tables");
DATA(insert OID = 2288 ( pg_size_pretty PGNSP PGUID 12 1 0 0 f f t f v 1 25 "20" _null_ _null_ _null_ pg_size_pretty _null_ _null_ _null_ ));
DESCR("convert a long int to a human readable text using size units");
diff --git a/src/include/storage/relfilenode.h b/src/include/storage/relfilenode.h
index 571f261c3d8..128cff99a9d 100644
--- a/src/include/storage/relfilenode.h
+++ b/src/include/storage/relfilenode.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/relfilenode.h,v 1.17 2008/09/30 10:52:14 heikki Exp $
+ * $PostgreSQL: pgsql/src/include/storage/relfilenode.h,v 1.18 2008/10/03 07:33:10 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,7 +25,10 @@ typedef enum ForkNumber
InvalidForkNumber = -1,
MAIN_FORKNUM = 0,
FSM_FORKNUM
- /* NOTE: change MAX_FORKNUM below when you add new forks */
+ /*
+ * NOTE: if you add a new fork, change MAX_FORKNUM below and update the
+ * name to number mapping in utils/adt/dbsize.c
+ */
} ForkNumber;
#define MAX_FORKNUM FSM_FORKNUM
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 09d38e9c1c3..58ccb03429d 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.320 2008/09/06 00:01:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.321 2008/10/03 07:33:10 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -389,10 +389,8 @@ extern Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS);
extern Datum pg_tablespace_size_name(PG_FUNCTION_ARGS);
extern Datum pg_database_size_oid(PG_FUNCTION_ARGS);
extern Datum pg_database_size_name(PG_FUNCTION_ARGS);
-extern Datum pg_relation_size_oid(PG_FUNCTION_ARGS);
-extern Datum pg_relation_size_name(PG_FUNCTION_ARGS);
-extern Datum pg_total_relation_size_oid(PG_FUNCTION_ARGS);
-extern Datum pg_total_relation_size_name(PG_FUNCTION_ARGS);
+extern Datum pg_relation_size(PG_FUNCTION_ARGS);
+extern Datum pg_total_relation_size(PG_FUNCTION_ARGS);
extern Datum pg_size_pretty(PG_FUNCTION_ARGS);
/* genfile.c */