ERROR: VACUUM cannot be executed from a function or multi-command string

From: "Mario Alberto Soto Cordones" <marioa(dot)soto(dot)cordones(at)gmail(dot)com>
To: "'Ayuda'" <pgsql-es-ayuda(at)postgresql(dot)org>, <pgsql-es-ayuda-owner(at)postgresql(dot)org>
Subject: ERROR: VACUUM cannot be executed from a function or multi-command string
Date: 2013-04-27 18:10:59
Message-ID: 517c06b1.449bec0a.6404.ffff8305@mx.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola Lista:

Tengo la siguiente función:

CREATE OR REPLACE FUNCTION public.vacuum_respalda_msj (

integer

)

RETURNS void AS

$body$

declare diaAnterior varchar;

declare funcion text := '';

BEGIN

select to_char(current_date - $1,'YYYYMMDD') into
diaAnterior;

funcion:= 'VACUUM (ANALYZE) mensaje_ms_' || diaAnterior || '
;';

EXECUTE FUNCION;

RETURN;

END;

$body$

LANGUAGE 'plpgsql'

VOLATILE

RETURNS NULL ON NULL INPUT

SECURITY INVOKER

COST 100;

La ejecuto de la siguiente forma:

select * from vacuum_respalda_msj(2);

y me da el siguiente error:

-- Executing query:

select * from vacuum_respalda_msj(2);

ERROR: VACUUM cannot be executed from a function or multi-command string

CONTEXT: SQL statement "VACUUM (ANALYZE) mensaje_ms_20130425 ;"

PL/pgSQL function "vacuum_respalda_msj" line 9 at EXECUTE statement

********** Error **********

ERROR: VACUUM cannot be executed from a function or multi-command string

SQL state: 25001

Context: SQL statement "VACUUM (ANALYZE) mensaje_ms_20130425 ;"

PL/pgSQL function "vacuum_respalda_msj" line 9 at EXECUTE statement

…he tratado de corregirla , pero me sigue dando el mismo error. Alguien me
podría dar una mano

Saludos

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2013-04-28 03:12:28 Re: ERROR: VACUUM cannot be executed from a function or multi-command string
Previous Message Mario Alberto Soto Cordones 2013-04-27 17:51:38 RE: Vacuum a una tablas