Re: pl/pgsql function not working

From: Darren Ferguson <darren(at)crystalballinc(dot)com>
To: Tom Jenkins <tjenkins(at)devis(dot)com>
Cc: Richard Huxton <dev(at)archonet(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: pl/pgsql function not working
Date: 2002-06-19 17:59:05
Message-ID: Pine.LNX.4.44.0206191357580.824-100000@thread.crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You can't use execute like that it discards the result unless you use it
in a FOR rec IN EXECUTE statement then you can get the results out.

EXECUTE ''UPDATE ''||obj.relname||'' set lastaccess = NULL;'';

This will work

Darren

On 19 Jun 2002, Tom Jenkins wrote:

> On Wed, 2002-06-19 at 10:09, Richard Huxton wrote:
> > On Wednesday 19 Jun 2002 2:25 pm, Tom Jenkins wrote:
> > > hello all,
> > > i hope somebody can shed some light on a problem i'm having with
> > > pl/pgsql.
> >
> > > PERFORM ''update % set lastaccess = NULL;'', obj.relname ;
> >
> > Are you sure this shouldn't be EXECUTE (build the sql-string normally first)
> >
>
> hrmmm.. replacing PERFORM with EXECUTE results in an error
>
> NOTICE: Error occurred while executing PL/pgSQL function
> clear_lastaccess
> NOTICE: line 6 at execute statement
> ERROR: query "SELECT 'update % set lastaccess = NULL;', $1 " returned
> 2 columns
>
>
>
>
>

--
Darren Ferguson

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Jenkins 2002-06-19 18:11:30 Re: pl/pgsql function not working
Previous Message Neal M. Holtz 2002-06-19 17:34:30 Re: Quoted identifiers in queries in plpgsql functions.