Re: Is there a way to test for UNASSIGNED in pl/pgsql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Is there a way to test for UNASSIGNED in pl/pgsql
Дата
Msg-id 20198.1351529846@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Is there a way to test for UNASSIGNED in pl/pgsql  (Hannu Krosing <hannu@2ndQuadrant.com>)
Ответы Re: Is there a way to test for UNASSIGNED in pl/pgsql
Список pgsql-hackers
Hannu Krosing <hannu@2ndQuadrant.com> writes:
> Would just converting UNDEFINED to NULL be a very bad idea ?

Yeah, it would, at least for the normal case where an undefined record
variable has no well-defined type either.  Saying that it's NULL doesn't
provide an answer to what type it has.

In the case of OLD/NEW we do know that they ought to have the rowtype of
the underlying table, so it's conceivable that we could pretend they are
nulls of that type.  But then you get into the question of whether a
NULL record is distinguishable from (NULL, NULL, ...) --- which would be
a perfectly legal real value of these records.  Note that the SQL
standard is pretty firmly on the side that says they are not
distinguishable.  I don't agree with that personally, but I don't think
it'd be a good idea to make a fundamental plpgsql feature depend on
being able to distinguish these states.

TBH, I think your request is ill-considered and should be rejected.
There is nothing whatsoever wrong with testing TG_OP to see what sort of
trigger you're in.
        regards, tom lane



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

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: Is there a way to test for UNASSIGNED in pl/pgsql
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Is there a way to test for UNASSIGNED in pl/pgsql