Thread: Allowing SYSDATE to Work

Allowing SYSDATE to Work

From
"Matt Miller"
Date:
I'd like SYSDATE to work syntactically and semantically the same as
CURRENT_TIMESTAMP (or CURRENT_TIME, or whatever).  I can create a
function called "sysdate" that does the trick, but then it seems I have
to reference the function as "sysdate ()," but I want to be able to get
away with just "sysdate."  It seems that CURRENT_TIMESTAMP and their
friends are magic functions that can be referenced without an explicit
empty argument list.

I have much Oracle-specific code that references sysdate, and porting
would be easier if that syntax could work unchanged in Postgres.

Re: Allowing SYSDATE to Work

From
Alvaro Herrera
Date:
Matt Miller wrote:
> I'd like SYSDATE to work syntactically and semantically the same as
> CURRENT_TIMESTAMP (or CURRENT_TIME, or whatever).  I can create a
> function called "sysdate" that does the trick, but then it seems I have
> to reference the function as "sysdate ()," but I want to be able to get
> away with just "sysdate."  It seems that CURRENT_TIMESTAMP and their
> friends are magic functions that can be referenced without an explicit
> empty argument list.

current_time and the like are hardcoded in the grammar.  You'd have to
do the same for sysdate.  It's not hard, but then I'd question the
hassle of having to patch all the Postgres installations you're going to
want to run your code on.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: Allowing SYSDATE to Work

From
Ron Johnson
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/17/06 16:31, Alvaro Herrera wrote:
> Matt Miller wrote:
>> I'd like SYSDATE to work syntactically and semantically the same as
>> CURRENT_TIMESTAMP (or CURRENT_TIME, or whatever).  I can create a
>> function called "sysdate" that does the trick, but then it seems I have
>> to reference the function as "sysdate ()," but I want to be able to get
>> away with just "sysdate."  It seems that CURRENT_TIMESTAMP and their
>> friends are magic functions that can be referenced without an explicit
>> empty argument list.
>
> current_time and the like are hardcoded in the grammar.  You'd have to
> do the same for sysdate.  It's not hard, but then I'd question the
> hassle of having to patch all the Postgres installations you're going to
> want to run your code on.

Or is he asking that this feature be added to PG?

- --
Ron Johnson, Jr.
Jefferson LA  USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFXkvcS9HxQb37XmcRAtwHAJ9+GBgAQHI9FoUhjGPmMgImb2cNfQCcC3zZ
2jk+k6ObhXKOZf+HV4j/OY8=
=5bRZ
-----END PGP SIGNATURE-----

Re: Allowing SYSDATE to Work

From
"Jim Nasby"
Date:
On Nov 17, 2006, at 4:26 PM, Matt Miller wrote:
> I'd like SYSDATE to work syntactically and semantically the same as
> CURRENT_TIMESTAMP (or CURRENT_TIME, or whatever).  I can create a
> function called "sysdate" that does the trick, but then it seems I
> have
> to reference the function as "sysdate ()," but I want to be able to
> get
> away with just "sysdate."  It seems that CURRENT_TIMESTAMP and their
> friends are magic functions that can be referenced without an explicit
> empty argument list.
>
> I have much Oracle-specific code that references sysdate, and porting
> would be easier if that syntax could work unchanged in Postgres.

If you've got a lot of Oracle-specific code you might want to
consider using EnterpriseDB.
--
Jim Nasby                               jim.nasby@enterprisedb.com
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)