Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 866762E0038 for ; Fri, 23 Nov 2007 13:06:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 69452-07 for ; Fri, 23 Nov 2007 13:06:05 -0400 (AST) Received: from sargon.lncsa.com (sargon.lncsa.com [212.99.8.251]) by postgresql.org (Postfix) with ESMTP id C7C352E0039 for ; Fri, 23 Nov 2007 13:06:14 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by sargon.lncsa.com (Postfix) with ESMTP id BFE653006415 for ; Fri, 23 Nov 2007 18:06:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lncsa.com Received: from sargon.lncsa.com ([127.0.0.1]) by localhost (sargon.lncsa.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m5qKz8JCC9bg for ; Fri, 23 Nov 2007 18:06:13 +0100 (CET) Received: from zenon.apartia.fr (zenon.apartia.fr [10.0.3.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "zenon.apartia.fr", Issuer "ca.apartia.fr" (verified OK)) by sargon.lncsa.com (Postfix) with ESMTP id A0B93300EB10 for ; Fri, 23 Nov 2007 18:06:13 +0100 (CET) Received: from trajan.apartia.fr (trajan.apartia.fr [10.0.3.121]) by zenon.apartia.fr (Postfix) with ESMTP id 9651159C6223E for ; Fri, 23 Nov 2007 18:06:12 +0100 (CET) Received: by trajan.apartia.fr (Postfix, from userid 1000) id 79BC0256ED73; Fri, 23 Nov 2007 18:06:12 +0100 (CET) Date: Fri, 23 Nov 2007 18:06:12 +0100 From: Louis-David Mitterrand To: pgsql-sql@postgresql.org Subject: Re: dynmic column names inside trigger? Message-ID: <20071123170611.GA31463@apartia.fr> Mail-Followup-To: pgsql-sql@postgresql.org References: <20071120161258.GA27106@apartia.fr> <4743F6E5.A3DD.0030.0@indicator.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4743F6E5.A3DD.0030.0@indicator.be> User-Agent: Mutt/1.5.17 (2007-11-01) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/127 X-Sequence-Number: 29655 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?