Tom Lane wrote:
> Karl Nack <karlnack(at)futurityinc(dot)com> writes:
> > I notice the row count does not reflect the newly-inserted row, which
> > suggests that the trigger is not seeing changes made to the table. This
> > seems to be exactly opposite of what's in the manual:
> > http://www.postgresql.org/docs/8.3/interactive/trigger-datachanges.html
> > http://www.postgresql.org/docs/8.3/interactive/trigger-example.html
>
> The reason is that you've declared the function STABLE, which causes it
> to use the calling query's starting snapshot. So it cannot see any
> in-progress changes of the calling query. Declare it VOLATILE (or
> let it default to that) and it will act as you expect.
>
> I'm not sure if the cited portions of the manual ought to contain notes
> about this or not. It seems a bit off-topic for them, but if other
> people have been bit by this, then maybe ... comments anyone?
I have applied the attached documentation patch to subtly mention this
issue.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
PG East: http://www.enterprisedb.com/community/nav-pg-east-2010.do
+ If your life is a hard drive, Christ can be your backup. +
Attachment: /rtmp/diff
Description: text/x-diff (1.5 KB)
In response to
pgsql-general by date
| Next: | From: Bruce Momjian | Date: 2010-02-25 23:21:58 |
| Subject: Re: trouble with to_char('L') |
| Previous: | From: Scott Marlowe | Date: 2010-02-25 20:13:05 |
| Subject: Re: Tool for determining field usage of database tables |