> Assuming that you are running Postgres on a linux system, you could do
> the following:
>
> 1) Create a partition with quotas enabled (via standard linux OS
> procedures). The postgres user is the user for which quotas should be
> enforced since postgresql always runs under the postgres uid.
>
> 2) Create a postgres tablespace using the newly created partition:
>
> psql> CREATE TABLESPACE dbspace LOCATION '/data/dbs';
>
> 3) Create the database on that tablespace:
>
> psql> CREATE DATABASE sales OWNER salesapp TABLESPACE dbspace;
>
> I have not tried this myself.
>
> As a side note, I'd say that limiting the size of a database to an
> arbitrary amount is problematic. Should a user actually exhaust the
> disk quota, Postgres will be unable to commit the transaction.
> Furthermore, it is difficult to recover from such a situation without
> major effort.
These links supplement the above comments:
http://www.postgresql.org/docs/8.1/interactive/disk-full.htmlhttp://www.postgresql.org/docs/8.1/interactive/manage-ag-tablespaces.html
Regards,
Richard Broersma Jr.