postgresql - get variables from record type in postgrsql -
i have record type variable new trigger. can variables record, not text representation. example:
create table test(x int, y varchar);
insert test values (1, 'test_var');
if new.*
(1, test_var)
there option record (1, 'test_var')
thanks. sorry mistakes, english not base language.
you should use point notation recordvar.field. in postgresql documentation lot of examples.
create table test(x int, y varchar); create or replace function trig_fx() returns trigger $$ begin raise notice '<<%>> <<%>>', new.x, new.y; return new; end; $$ language plpgsql; create trigger trig before insert on test each row execute procedure trig_fx(); postgres=# insert test values(1, 'test var'); notice: <<1>> <<test var>> insert 0 1
Comments
Post a Comment