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

Re: missing function datetime()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Moray McConnachie" <moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: missing function datetime()
Date: 2000-02-25 16:36:23
Message-ID: 7619.951496583@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-sql
moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk writes:
> It looks like replacing all occurrences of datetime with timestamp in
> the script works - even for the few functions I have that used the
> datetime() function.

Oooh --- another case we didn't think about.  We really should continue
to make a function named datetime() available, even though the type it
produces will officially be named timestamp.

I can see two ways to do that: either add another function to pg_proc
(five of them actually :-(), or hack the parser to translate a function
name 'datetime' to 'timestamp'.  Ugly as the second one sounds, it has
a couple of advantages.  First, it would provide an automatic upgrade
path: future dumps of 7.0 databases would show the correct function
name, at least for uses in rules.  So we could hope to get rid of the
compatibility hack someday.  Second, the parser has special treatment
for functions that are named the same as datatypes --- it knows they
represent type coercions --- so a function named "datetime" won't really
work quite the way it should for type resolution.

Not sure which way to jump.  Comments anyone?

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Rini DuttaDate: 2000-02-25 16:47:31
Subject: Using libpq in a multithreaded environment
Previous:From: Tom LaneDate: 2000-02-25 16:29:16
Subject: Re: [SQL] how to create index on timestamp field in pre v7 database

pgsql-sql by date

Next:From: Sevo StilleDate: 2000-02-25 16:38:34
Subject: Re: [SQL] Finding missing records...
Previous:From: Tom LaneDate: 2000-02-25 16:29:16
Subject: Re: [SQL] how to create index on timestamp field in pre v7 database

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