Re: multiple CREATE FUNCTION AS items for PLs - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: multiple CREATE FUNCTION AS items for PLs
Date
Msg-id 1355693019.4311.16.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: multiple CREATE FUNCTION AS items for PLs  (Hannu Krosing <hannu@krosing.net>)
Responses Re: multiple CREATE FUNCTION AS items for PLs  (Hannu Krosing <hannu@2ndQuadrant.com>)
List pgsql-hackers
On Sun, 2012-12-16 at 19:13 +0100, Hannu Krosing wrote:
> As an idea seems quite good, but maybe the "run once" part could use
> its
> own keyword in the future, something like PREPARE or REQUIRE?

Well, either we do it in a language independent way, in which case this
would be too prescriptive, or we do it in a Python-specific way (less
likely), but "prepare" or "require" are not Python concepts.

> WHile at it, why not also fix the functions to be real function
> _with_ _real_ _arguments_ , not arguments-passed-in-as-globals
> 
> and at least we could call this function with its real name inside its
> own module
> (stored global namespace) so we could easily do recursion
> 
> CREATE FUNCTION factorial(n bigint) returns bigint LANGUAGE plpythonu
> AS $$
>      if n==0: return 1
>      return factorial(n-1) * n
> $$;
> 
These are also good things to fix, but are they related?  Could they not
be fixed independently?




pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: multiple CREATE FUNCTION AS items for PLs
Next
From: Alexander Korotkov
Date:
Subject: Re: WIP: index support for regexp search