Re: pg_database_size(oid)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dhimant Patel <drp4kri(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_database_size(oid)
Date: 2010-02-17 17:16:41
Message-ID: 28605.1266427001@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dhimant Patel <drp4kri(at)gmail(dot)com> writes:
> I have created a database, which I plan to load with several tables. I am
> trying to find the size of the databases and came
> across pg_database_size(oid) function. Since it requires databse oid, I
> thought there must be a view where you get it - then came across
> "pg_database" table and still all in vain. The "pg_database" table lists all
> databases in the server but won't provide me the oid
> for pg_database_size().

What you lack is the knowledge that oid is a system column in these
tables, meaning it isn't displayed by "SELECT * FROM ...". It's there
though and you can select it explicitly:
select oid from pg_database where datname = 'foo';

http://www.postgresql.org/docs/8.4/static/ddl-system-columns.html

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Reid Thompson 2010-02-17 18:52:06 Re: pg_database_size(oid)
Previous Message Dhimant Patel 2010-02-17 16:59:06 pg_database_size(oid)