Re: [HACKERS] Lost a function overloading capability in v6.3

From: jwieck(at)debis(dot)com (Jan Wieck)
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: meskes(at)topsystem(dot)de, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Lost a function overloading capability in v6.3
Date: 1998-03-04 10:45:05
Message-ID: m0yABfe-000BFRC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Tom wrote:

> > > When I run this same thing on v6.3, I get a date sometime in 1974 which
> > > I think might actually be derived from a pointer interpreted as an
> > > integer :(
> > >
> > > postgres=> select abstime_datetime(0);
> > > abstime_datetime
> > > ----------------------------
> > > Wed Apr 24 18:51:28 1974 GMT
> > > (1 row)
> > > postgres=> select abstime_datetime(900000000);
> > > abstime_datetime
> > > ----------------------------
> > > Wed Apr 24 18:37:12 1974 GMT
> > > (1 row)
> >
> > mm=> select abstime_datetime(0);
> > abstime_datetime
> > ----------------
> > epoch
> > (1 row)
> >
> > mm=> select abstime_datetime(900000000);
> > abstime_datetime
> > ----------------
> > epoch
> > (1 row)
>
> OK, so that is on a v6.3 system Michael? Then does anyone have an idea why
> my system is showing a problem? Can someone running on Linux (RH4.2, 2.0.30
> kernel) try this out?? _Everything_ in the regression tests is OK...

The bug is that when the language is internal but the
function isn't in the builtin table, fmgr_info() (in fmgr.c)
doesn't set fn_nargs. So fmgr_c() calls abstime_datetime()
without arguments.

Add

finfo->fn_nargs = procedureStruct->pronargs;

in the INTERNALlanguageId arm of the switch in fmgr.c (line
198).

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-03-04 13:31:26 Re: Glibc2 (was Re: [HACKERS] PostgreSQL - the Linux of Databases...)
Previous Message Zeugswetter Andreas SARZ 1998-03-04 10:02:02 Feature: output index name in explain ...