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

Lost a function overloading capability in v6.3

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Postgres Hackers List <hackers(at)postgresql(dot)org>
Subject: Lost a function overloading capability in v6.3
Date: 1998-03-03 13:54:34
Message-ID: 34FC0B9A.5F645148@alumni.caltech.edu (view raw or flat)
Thread:
Lists: pgsql-hackers
I had developed a "cheat" to help people convert Unix system time stored
as an integer into a true date/time type. I noticed that it did not work
prior to the v6.3 release, but have now gone back to v6.2.1 and
confirmed that it works there. Can someone test this on their
installation and confirm that it is a problem for all v6.3 (since
someone reported that it worked for them earlier, but I'm not sure how
that could be):

  CREATE FUNCTION abstime_datetime(int4)
  RETURNS datetime
  AS '-' LANGUAGE 'internal';

For v6.2.1, here is the result:

postgres=> select abstime_datetime(0);
abstime_datetime
----------------
epoch
(1 row)
postgres=> select abstime_datetime(900000000);
abstime_datetime
----------------------------
Thu Jul 09 16:00:00 1998 GMT
(1 row)

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)

Any ideas where to look? It would be a shame to lose this capability.
Although the example is perhaps not too respectable, it illustrates a
useful feature...

                                                                       -
Tom


Responses

pgsql-hackers by date

Next:From: Michael MeskesDate: 1998-03-03 14:03:17
Subject: Re: [HACKERS] Lost a function overloading capability in v6.3
Previous:From: Zeugswetter Andreas SARZDate: 1998-03-03 13:41:32
Subject: text should be a blob field

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