Nelson Ferreira Jr <nelson@radix.com.br> writes:
> The return type of the function must be OPAQUE, it means that the NEW
> variable is returned (NEW represents the row that is being inserted and so
> fired the trigger)
Type "OPAQUE" means too many different things at the moment --- in some
uses it means "VOID" and in some other ones it means "some type that's
not described in pg_type". ON-INSERT trigger functions have to return
the tuple to be inserted, and HeapTuple is not a type known to pg_type,
so OPAQUE is the right declaration; but it's confusing and error-prone.
I've been thinking about proposing a cleanup that would replace OPAQUE
with multiple special-purpose pseudo-datatypes, but I'm not sure that
improving clarity is worth the price of making everyone change all
their trigger function definitions ...
regards, tom lane