Broken handling of NULLs in TG_ARGV
От | Jim Nasby |
---|---|
Тема | Broken handling of NULLs in TG_ARGV |
Дата | |
Msg-id | 5542BA1F.40501@BlueTreble.com обсуждение исходный текст |
Ответы |
Re: Broken handling of NULLs in TG_ARGV
|
Список | pgsql-hackers |
plpgsql's handling of NULLs in TG_ARGV turns actual nulls into text 'null'. Hopefully we can all agree that's broken. I'd like to fix it, but wonder how to handle existing user code. My suspicion is that most users will never notice this and I can just fix it. I could also add a plpgsql option to provide the old behavior. What I'd prefer not to do is keep defaulting to the current behavior. Users are unlikely to notice that, keep using the broken behavior, and still complain when we change the default. decibel@decina.local=# create temp table t(t text); CREATE TABLE decibel@decina.local=# create function tg() returns trigger language plpgsql as $$BEGIN RAISE '"%" is null? %', tg_argv[0], tg_argv[0] is null; end$$; CREATE FUNCTION decibel@decina.local=# create trigger t before insert on t for each row execute procedure tg(NULL); CREATE TRIGGER decibel@decina.local=# insert into t values('a'); ERROR: "null" is null? f decibel@decina.local=# drop trigger t on t; DROP TRIGGER decibel@decina.local=# create trigger t before insert on t for each row execute procedure tg(); CREATE TRIGGER decibel@decina.local=# insert into t values('a'); ERROR: "<NULL>" is null? t decibel@decina.local=# drop trigger t on t; DROP TRIGGER decibel@decina.local=# create trigger t before insert on t for each row execute procedure tg('null'); CREATE TRIGGER decibel@decina.local=# insert into t values('a'); ERROR: "null" is null? f decibel@decina.local=# -- Jim Nasby, Data Architect, Blue Treble Consulting Data in Trouble? Get it in Treble! http://BlueTreble.com
В списке pgsql-hackers по дате отправления: