Skip site navigation (1) Skip section navigation (2)

Re: vacuumdb for schema only

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Bèrto ëd Sèra <berto(dot)d(dot)sera(at)gmail(dot)com>
Cc: isabella(dot)ghiurea(at)nrc-cnrc(dot)gc(dot)ca, pgsql-admin(at)postgresql(dot)org
Subject: Re: vacuumdb for schema only
Date: 2010-09-08 13:06:55
Message-ID: AANLkTi=Prb0rHp-YmKuafuZNrFM4yzvsGftA6uZwH80V@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-admin
2010/9/8 Bèrto ëd Sèra <berto(dot)d(dot)sera(at)gmail(dot)com>

> Hi!
>
> I would also expect you to be able to make a Stored Procedure executing the
> same command, although I never tried it myself.
>
>
It is not possible... vacuum cannot be executed inside a function or
transaction.

See de sample:

-- Using function
CREATE OR REPLACE FUNCTION fc_vacuum(TEXT) RETURNS VOID AS
$$
BEGIN
  EXECUTE 'VACUUM '||$1;
  RETURN;
END;
$$
LANGUAGE plpgsql;


postgres(at)bdteste=# select fc_vacuum('foo');
ERROR:  VACUUM cannot be executed from a function
CONTEXT:  SQL statement "VACUUM foo"
PL/pgSQL function "fc_vacuum" line 2 at execute statement


-- Using transaction
postgres(at)bdteste=# begin;
BEGIN
postgres(at)bdteste=# VACUUM foo;
ERROR:  VACUUM cannot run inside a transaction block


Best regards,

-- 
Fabrízio de Royes Mello
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello

In response to

Responses

pgsql-admin by date

Next:From: Bèrto ëd SèraDate: 2010-09-08 13:10:39
Subject: Re: vacuumdb for schema only
Previous:From: Thomas UzunoffDate: 2010-09-08 08:44:14
Subject: PostgreSQL article online - PDF

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group