Skip site navigation (1) Skip section navigation (2)

Re: Bug in triggers

From: Chris Travers <chris(at)metatrontech(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Oleg Serov <serovov(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug in triggers
Date: 2010-03-09 15:46:16
Message-ID: 5ed37b141003090746s2d46abe5o1a952d3f9311e240@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Tue, Mar 9, 2010 at 7:31 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> 2010/3/9 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>> What seems odd to me is that NEW is apparently some other kind of
>>> thing that is not the same kind of thing as the row variable.
>>
>> NEW is a record variable, not a row variable.  In this context that's
>> sensible because its actual rowtype is unspecified by the function text.
>> The implications for row-null handling aren't obvious though :-(
>>
>
> is it necessary definition there? This is defined well from context.
>
I am assuming that Tom's previous objections may have to do with
C-language triggers as well but I couldn't tell from reading the docs.
 This may because I am no C-guru.

I think this behavior is unexpected, but not a bug.  The best fix is
documenting the datatype better.  Something like adding a paragraph to
chapter 38.9 just above the examples (going off the 8.4 docs):

Please note, NEW and OLD records are not guaranteed to follow the full
internal representation of the tuple in question.  In some cases (such
as casting to text) this can create subtle differences which make
comparisons problematic.  In some cases you may need to properly cast
NEW and OLD prior to making comparisons.

Best Wishes,
Chris Travers

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2010-03-09 15:51:14
Subject: Re: duplicate key violates unique contraint on pg_type_typname_nsp_index
Previous:From: Pavel StehuleDate: 2010-03-09 15:31:10
Subject: Re: Bug in triggers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group