referencing an unknown variable in the NEW record in a trigger

Поиск
Список
Период
Сортировка
От Conrad Vermeulen
Тема referencing an unknown variable in the NEW record in a trigger
Дата
Msg-id FKEMIMFAIHJKGEBKMNNNEEHDCEAA.conrad@fastforward.za.net
обсуждение исходный текст
Список pgsql-admin
Hi,

I have a situation where I need to dereference the fields in the NEW record
within a trigger.

I know the standard way where NEW.fieldname where fieldname is known before
hand. What if fieldname is a text variable?

Say,

--------------------------

DECLARE

    fldname text;

begin
    fldname = 'name';


    raise exception '% has value %', fldname, NEW.fldname; -- is this possible?

    return NEW;
end;

--------------------------

is there a way such as NEW.fldname, or NEW.%fldname, or NEW.$fldname?


Any help appreciated,

Thanks,

Conrad


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

Предыдущее
От: "Glenn Wiorek"
Дата:
Сообщение: Re: language "plpgsql" does not exist
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Prompts in psql