Re: triggers and execute... - Mailing list pgsql-general

From Sam Mason
Subject Re: triggers and execute...
Date
Msg-id 20090428091547.GD12225@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to Re: triggers and execute...  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
On Mon, Apr 27, 2009 at 03:37:22PM -0600, Scott Marlowe wrote:
> On Mon, Apr 27, 2009 at 3:24 PM, Richard Broersma wrote:
> > At this point I don't think that there is a way for this function to
> > know the correct table type of new.* since page_access_... is still
> > only a concatenated string.  There there a way to cast new.* to the
> > correct table type as part of this insert statement?
>
> I tried casting the new.*::page_access and that didn't work.  For now
> I'll carry on with the complete listing of everything.

In SQL I can do:

  PREPARE _p(parent) AS INSERT INTO subtable SELECT ($1).*;
  EXECUTE _p(new);
  DEALLOCATE _p;

however this seems to interact badly with the EXECUTE in plpgsql, not
sure how to work around that.

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

pgsql-general by date:

Previous
From: itishree sukla
Date:
Subject: Issue with POSTGIS
Next
From: Jasen Betts
Date:
Subject: Re: deleting function