Search Postgresql Archives

Re: Question of using trigger's OLD in EXECUTE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you Sam!!
The code in the posting solves my issue.  :)

Nim

On 10/23/2009 12:07 PM, Sam Mason wrote:
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


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux