Re: Regarding niladic functions

From: Neil Conway <neilc(at)samurai(dot)com>
To: Chandra Sekhar Surapaneni <chandu(at)positivenetworks(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Regarding niladic functions
Date: 2005-04-05 04:26:57
Message-ID: 42521391.8010601@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chandra Sekhar Surapaneni wrote:
> Can we write our own niladic functions in 8.0.0? I want to write a
> niladic function similar to current_timestamp, but I did not find any
> information in the documentation.

If you mean a function without any arguments, it is trivial:

CREATE FUNCTION foo() RETURNS ... AS ...;
SELECT foo();

If you mean a function that doesn't take any arguments and can be
invoked without an empty set of parentheses (like current_timestamp),
there isn't a way to define such a function via SQL. You could probably
hack the SQL parser to add support for specific functions like this, as
is done for current_timestamp and friends.

-Neil

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message go 2005-04-05 04:35:54 Re: How to dump data from database?
Previous Message Michael Fuhr 2005-04-05 04:21:54 Re: How to dump data from database?