REINDEX inside plpgsql function

From: Ben Ausden <Benedict(dot)Ausden(at)navyblue(dot)com>
To: "Pgsql-General (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: REINDEX inside plpgsql function
Date: 2002-07-29 17:13:55
Message-ID: 4E7F1D9D8CDF394BB516B88050CB90D133A0AB@www.thinking-out-louder.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Is it possible to use REINDEX TABLE inside plpgsql functions? Using it
inside a plpgsql block causes an error: 'The tuple isn't committed'. A
Google search on the error returned precisely 0 results ;-)

Postgres 7.2.1 on Linux/RH7.2

-- function definition
CREATE FUNCTION refresh_rcsdata(text) RETURNS int4 AS '
DECLARE
filename ALIAS FOR $1;

BEGIN

-- remove all data from rcsdata table
TRUNCATE TABLE rcsdata;

-- load new data and reindex
EXECUTE ''COPY rcsdata FROM '' || quote_literal(filename) || '' USING
DELIMITERS ''''\t'''' '';
REINDEX TABLE rcsdata;
RETURN 1;

END;
' LANGUAGE 'plpgsql';

thanks,
ben

--
benedict ausden
senior developer, navyblue new media
[t] 0131 553 0100
[e] benedict (a t) navyblue.com

www.navyblue.com
Scottish Design Consultancy of the Year 2002

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Kirkwood 2002-07-29 17:17:39 Re: tsearch - Regression tests fail
Previous Message Oleg Bartunov 2002-07-29 16:46:33 Re: tsearch - Regression tests fail