Re: creating a function with another function

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Dave Huber <DHuber(at)letourneautechnologies(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: creating a function with another function
Date: 2009-10-12 19:54:31
Message-ID: b42b73150910121254x3f566b57y976a24d878561897@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 12, 2009 at 3:41 PM, David Fetter <david(at)fetter(dot)org> wrote:
> On Mon, Oct 12, 2009 at 02:12:35PM -0500, Dave Huber wrote:
>> Is it possible to execute a CREATE OR REPLACE FUNCTION with another
>> function or even have a function modify itself?
>
> Yes, but doing any of that is a sign that you're working with a broken
> design.  That, or you're looking to make an entry in the International
> Obfuscated Database Programming Contest ;)

Surely, there are valid cases of having a function create a function.
Suppose (just off the top of my head), you create a helper function
that generates triggers on a table for record archiving.

I agree though that having a function modify itself sounds like
something that is much better done as dynamic sql (inside a function).

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dave Huber 2009-10-12 20:36:47 Re: creating a function with another function
Previous Message David Fetter 2009-10-12 19:41:57 Re: creating a function with another function