About array in PlPgsql trigger function

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: About array in PlPgsql trigger function
Date: 2006-03-08 14:16:54
Message-ID: 440EE756.7090007@encs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

In PostgreSQL 8.0.1 (plpgsql), I was trying to use array in the trigger
function.

DECLARE
clear_id_colValueArr VARCHAR[100];
BEGIN
clear_id_colValueArr[1] := NEW.clear_id1;
clear_id_colValueArr[2] := NEW.clear_id2;
clear_id_colValueArr[3] := NEW.clear_id3;
....
clear_id_colValueArr[100] := NEW.clear_id100;
...
END;

I always get NULL for clear_id_colValueArr. Also, I tried to run
raise notice '%', clear_id_colValueArr[0], I got an compile error.

Could someone tell me how to use array in a trigger function please?

Also, is there a way that I can get NEW.ColValues by specifying column
number but not NEW.ColumnName?

Thanks a lot,
Ying

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matroska80 2006-03-08 14:27:01 Tsearch2 cache lookup problem
Previous Message Kenneth Downs 2006-03-08 14:06:36 plperl %_SHARED and rollbacks