Received: from etabeta.xt.net (IDENT:root@etabeta.xt.net [62.212.0.40]) by hub.org (8.9.2/8.9.1) with ESMTP id VAA71027 for ; Sat, 17 Apr 1999 21:37:55 -0400 (EDT) (envelope-from daniele@orlandi.com) Received: from orlandi.com (nabla.xt.net [62.212.0.41]) by etabeta.xt.net (8.9.3/8.8.8) with ESMTP id DAA03372 for ; Sun, 18 Apr 1999 03:37:53 +0200 Message-ID: <37193771.230EA8FA@orlandi.com> Date: Sun, 18 Apr 1999 03:37:53 +0200 From: Daniele Orlandi Organization: Utility Line Italia X-Mailer: Mozilla 4.51 [en] (WinNT; U) X-Accept-Language: it MIME-Version: 1.0 To: pgsql-sql@postgreSQL.org Subject: PL/TCL and NULL values Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I created this trigger to implement templates for a fields in a table. This works except if fieldvalue in template is NULL. In that case, the field is excluded in the array and the "set" directive fails. How can I copy NULL values from TPL to NEW array ? I think I should test if the value is the array and avoid to execute the set directive if not, but I'm totally a newbie with TCL. Please help ! :^) CREATE FUNCTION users_trig_func() RETURNS opaque AS ' spi_exec -array TPL "SELECT * FROM $1 WHERE template= \'$NEW(template)\' AND force=\'f\'" { set NEW($TPL(fieldname)) $TPL(fieldvalue) } return [array get NEW] ' LANGUAGE 'pltcl'; Thanks in advance. Bye! -- Daniele ------------------------------------------------------------------------------- "Besides, I think [Slackware] sounds better than 'Microsoft,' don't you?" (By Patrick Volkerding) ------------------------------------------------------------------------------- Dal 01-03-1993, con un solo POP abbiamo fatto guadagnare a telecom italia 27.325.828 Lire solo in scatti alla risposta. Non male eh ? ------------------------------------------------------------------------------- Daniele Orlandi - Utility Line Italia - http://www.orlandi.com Via Mezzera 29/A - 20030 - Seveso (MI) - Italy -------------------------------------------------------------------------------