Re: Question of using trigger's OLD in EXECUTE

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Question of using trigger's OLD in EXECUTE
Date: 2009-10-23 16:07:19
Message-ID: 20091023160719.GH5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 23, 2009 at 11:27:11AM -0400, Nim Li wrote:
> CREATE OR REPLACE FUNCTION cp_tbl() RETURNS TRIGGER AS $proc$
> BEGIN
> EXECUTE 'INSERT INTO ' ||
> TG_ARGV[0] ||
> ' SELECT ' ||
> OLD;
> RETURN NEW;
> END;
> $proc$ LANGUAGE plpgsql;
>
> At run-time, it prompts an error:

> Does anyone have any idea how to fix it?

You need to quote your literals! :) The details are a bit fiddly, but
the following thread covered similar things recently:

http://archives.postgresql.org/pgsql-general/2009-09/msg01176.php

--
Sam http://samason.me.uk/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua Berry 2009-10-23 16:36:35 Re: Error when trying to use pg_dump on 8.3 after minor release update
Previous Message Joshua Berry 2009-10-23 16:06:10 Error when trying to use pg_dump on 8.3 after minor release update