plpgsql Field of Record issue

From: "Rod Taylor" <rbt(at)zort(dot)ca>
To: "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Subject: plpgsql Field of Record issue
Date: 2002-03-03 03:15:16
Message-ID: 022b01c1c262$461eed20$8001a8c0@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Is there any other way to accomplish NEW.TG_ARGV[0] in plpgsql, or am
I stuck writing a C function which will allow:
_value := getRecordValue(NEW, TG_ARGV[0]).

create table test(col1 int4);

create or replace function test() returns opaque as '
declare
_value int4;
begin
RAISE NOTICE ''Args: %'', TG_NARGS;
RAISE NOTICE ''Column: %'', TG_ARGV[0];

-- PARSE ERROR
_value := NEW.TG_ARGV[0];

RAISE NOTICE ''Data: %'', _value;
end;
' language 'plpgsql';

create trigger name BEFORE INSERT ON test
FOR EACH ROW
EXECUTE PROCEDURE test('col1');
--
Rod Taylor

Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. You cannot imagine why you ever felt
otherwise.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-03-03 05:08:41 Re: elog() patch
Previous Message Bruce Momjian 2002-03-03 02:46:05 Re: elog() patch