Received: from gl.aser.de (gl.aser.de [213.252.128.30]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f28H7mx57618 for ; Thu, 8 Mar 2001 12:07:48 -0500 (EST) (envelope-from gcg@gl.aser.de) Received: from pinguin (gcg@node120.dial.Uni-Magdeburg.DE [141.44.160.120]) by gl.aser.de (8.11.2/8.11.2/Debian 8.11.2-1) with SMTP id f28HCkC09461 for ; Thu, 8 Mar 2001 18:12:46 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Christof Glaser Organization: gl.aser software engineering . internet service To: pgsql-sql@postgresql.org Subject: Re: How to build this field Date: Thu, 8 Mar 2001 18:13:38 +0100 X-Mailer: KMail [version 1.2] References: In-Reply-To: MIME-Version: 1.0 Message-Id: <0103081813380F.12945@pinguin> Content-Transfer-Encoding: 8bit X-Archive-Number: 200103/180 X-Sequence-Number: 1833 Josh, > > [ stuff deleted ] > > CREATE FUNCTION metakey (text, int4, int4) returns text as > > ' SELECT $1 || ' ' || text($2) || ' ' || text($3) ' > > LANGUAGE 'sql'; > > > > || is the "concatenate text" operator. > > > > Change the param types and cast them as you need. > > ... But keep in mind that if any of the above values are NULL, the > whole expression will be NULL. If one or more of the columns allows > NULLs, you will need a function that includes testing for NULL. > > -Josh Berkus Thanks for the hint. COALESCE is your friend, then :) Christof. -- gl.aser . software engineering . internet service http://gl.aser.de/ . Planckstraße 7 . D-39104 Magdeburg Tel. +49.391.7 44 77 10 . Fax +49.391.7 44 77 13 . Mobil 0177.77 92 84 3