vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Here's a test case for a pg_total_relation_size() failure: test=> CREATE TABLE foo (id integer); CREATE TABLE test=> SELECT oid, relfilenode FROM pg_class WHERE relname = 'foo'; oid | relfilenode -------+------------- 26235 | 26235 (1 row) test=> SELECT pg_total_relation_size('foo'); pg_total_relation_size ------------------------ 0 (1 row) test=> TRUNCATE foo; TRUNCATE TABLE test=> SELECT oid, relfilenode FROM pg_class WHERE relname = 'foo'; oid | relfilenode -------+------------- 26235 | 26237 (1 row) test=> SELECT pg_total_relation_size('foo'); ERROR: could not open relation with OID 26237 test=> SELECT pg_total_relation_size(26235); ERROR: could not open relation with OID 26237 test=> SELECT pg_relation_size('foo'); pg_relation_size ------------------ 0 (1 row) -- Michael Fuhr ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |
| |||
| On Wed, Sep 28, 2005 at 10:25:16PM -0600, Michael Fuhr wrote: > test=> TRUNCATE foo; > TRUNCATE TABLE > test=> SELECT oid, relfilenode FROM pg_class WHERE relname = 'foo'; > oid | relfilenode > -------+------------- > 26235 | 26237 > (1 row) The code is obviously confused between Oid and relfilenode. The calculate_total_relation_size() function gets a relfilenode parameter and then tries to call relation_open() with it. This is wrong. I'll submit/commit a patch fixing this, later today. Thanks for the test case. -- Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 17.7", W 73º 14' 26.8" "Granting software the freedom to evolve guarantees only different results, not better ones." (Zygo Blaxell) ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |
| ||||
| I wrote: > The code is obviously confused between Oid and relfilenode. The > calculate_total_relation_size() function gets a relfilenode parameter > and then tries to call relation_open() with it. This is wrong. This is the patch I'm about to apply. Besides fixing this particular problem, I made the code include the size of the index of the TOAST table in pg_total_relation_size(). -- Alvaro Herrera Architect, http://www.EnterpriseDB.com "En las profundidades de nuestro inconsciente hay una obsesiva necesidad de un universo lógico y coherente. Pero el universo real se halla siempre un paso más allá de la lógica" (Irulan) ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |