| From: | Daniele Orlandi <daniele(at)orlandi(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgreSQL(dot)org |
| Subject: | PL/TCL and NULL values |
| Date: | 1999-04-18 01:37:53 |
| Message-ID: | 37193771.230EA8FA@orlandi.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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
-------------------------------------------------------------------------------
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 1999-04-18 17:51:32 | Re: [SQL] Trouble with null text fields! |
| Previous Message | david | 1999-04-18 00:54:33 | Impossible query with SQL? or not? |