Re: Triggers on columns - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Triggers on columns
Date
Msg-id 1254510268.27017.2.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: Triggers on columns  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: Triggers on columns
List pgsql-hackers
On Thu, 2009-10-01 at 10:40 +0900, Itagaki Takahiro wrote:
> > Peter Eisentraut <peter_e@gmx.net> wrote:
> > > If you want a "pretty" option on pg_get_triggerdef(), you could nowadays
> > > also implement that via a parameter default value instead of a second
> > > function.
> > 
> > OK, I'll rewrite it to use default parameter.
> 
> I tried to remove pg_get_triggerdef_ext() and add a second argument
> with default value to pg_get_triggerdef(), but there is a problem.
> 
> The definition of pg_get_triggerdef will be the following:
>     DATA(insert OID = 1662 (
>         pg_get_triggerdef    PGNSP PGUID 12 1 0 0 f f f t f s 2 1 25 "26 16" _null_ _null_ _null_
>         "({CONST :consttype 16 :consttypmod -1 :constlen 1 :constbyval true :constisnull false :location 41
:constvalue1 [ 0 0 0 0 0 0 0 0 ]})"
 
>         pg_get_triggerdef _null_ _null_ _null_ ));
> 
> The problem is in :constvalue part; It will be
> ":constvalue 1 [ 0 0 0 0 0 0 0 0 ]" on 64bit platform, but
> ":constvalue 1 [ 0 0 0 0 ]" on 32bit platform.
> I think we should not use default values in functions listed on pg_proc.h,
> so the previous patch is better than default value version.

OK, but what you can do is point both variants to the same C function
and check with PG_NARGS() with how many arguments you were called.  That
would save some of the indirections.



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: latest hstore patch
Next
From: Simon Riggs
Date:
Subject: Re: Hot Standby 0.2.1