Re: [SQL] new.oid not working inside rule [repost] - Mailing list pgsql-sql

From wieck@debis.com (Jan Wieck)
Subject Re: [SQL] new.oid not working inside rule [repost]
Date
Msg-id m11GHqN-0003kLC@orion.SAPserv.Hamburg.dsh.de
Whole thread Raw
In response to new.oid not working inside rule [repost]  (Michael Olivier <mo@local2me.com>)
List pgsql-sql
>
> I am reposting this because I haven't gotten an answer... is anyone
> successfully using new.oid within a rule to store the oid of an inserted
> row into another table?  (See below)
>
> This is in 6.4.2-3.

    It cannot work - sorry.

    This  is because of the way rules are executed. If you have a
    rule on INSERT, this rules action is executed  prior  to  the
    INSERT  itself  and  will do mainly the same scans to collect
    the  data  that  will   be   inserted   (in   the   case   of
    INSERT...SELECT...). At this time, the OID's which will later
    get assigned aren't known.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #

pgsql-sql by date:

Previous
From: Matthew Hagerty
Date:
Subject: Stepping through a table.
Next
From: Stuart Rison
Date:
Subject: Re: [SQL] Anyone recognise this error from PL/pgSQL?