Re: dynmic column names inside trigger?

From: Louis-David Mitterrand <vindex+lists-pgsql-sql(at)apartia(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: dynmic column names inside trigger?
Date: 2007-11-23 17:06:12
Message-ID: 20071123170611.GA31463@apartia.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Nov 21, 2007 at 09:14:14AM +0100, Bart Degryse wrote:
> I would do something like this (not tested, but conceptually working):
>
> CREATE or replace FUNCTION sanitize_text(webtext IN text, cleantext OUT text) AS
> $body$
> BEGIN
> cleantext = translate(webtext, E'\x92\x96', '''-');
> cleantext = regexp_replace(cleantext, E'\x9c', 'oe', 'g');
> cleantext = regexp_replace(cleantext, E'\x85', '...', 'g');
> END;
> $body$
> LANGUAGE plpgsql VOLATILE RETURNS NULL ON NULL INPUT;

Hi,

I was curious as to why you created this function with a prototype of

func(intext IN text, outtext OUT text) ... returns NULL

instead of the usual

func(intext text) ... returns TEXT

Is that a more efficient way?

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2007-11-23 20:54:06 Re: dynmic column names inside trigger?
Previous Message Sabin Coanda 2007-11-23 11:42:50 Re: Aleatory exception - found cause