PL/TCL and NULL values

Поиск
Список
Период
Сортировка
От Daniele Orlandi
Тема PL/TCL and NULL values
Дата
Msg-id 37193771.230EA8FA@orlandi.com
обсуждение исходный текст
Список 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
fattoguadagnare a telecom italia27.325.828 Lire solo in scatti alla risposta. Non male eh ?
 
-------------------------------------------------------------------------------Daniele Orlandi - Utility Line Italia -
http://www.orlandi.comViaMezzera 29/A - 20030 - Seveso (MI) - Italy
 
-------------------------------------------------------------------------------


В списке pgsql-sql по дате отправления:

Предыдущее
От: david
Дата:
Сообщение: Impossible query with SQL? or not?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] Trouble with null text fields!