Re: Recent MemSet change to DirectFunctionCall1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Halliwell <mark(at)transportservices(dot)com(dot)au>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Recent MemSet change to DirectFunctionCall1
Date: 2003-01-09 07:01:38
Message-ID: 27389.1042095698@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Mark Halliwell <mark(at)transportservices(dot)com(dot)au> writes:
> I recently upgraded from 7.2.1 to 7.3 and found that one of my triggers
> stopped working; it would report:
> ERROR: TIMESTAMP(-1073746888) precision must be between 0 and 6
> The trigger is used to set the time a record changes and does the following
> call:
> DirectFunctionCall1(timestamp_in, CStringGetDatum("now"));
> (My trigger was based upon the code in contrib/spi/moddatetime.c)

This trigger is in error, as is moddatetime.c (I will fix the latter).
If you call a system function, it is up to you to call it with the
appropriate parameter list.

> ! #define PG_GETARG_DATUM(n) (fcinfo->arg[n])
> --- 167,173 ----
> ! #define PG_GETARG_DATUM(n) (n >= fcinfo->nargs ? NULL:fcinfo->arg[n])

This is certainly not a fix. NULL is not even a valid value for
non-pointer argument types, and for those that are pointers, it would
mean instant core dump...

regards, tom lane

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Patrick Macdonald 2003-01-09 12:18:17 Re: updated PITR patch
Previous Message Neil Conway 2003-01-09 04:21:02 Re: updated PITR patch