Immediate problem
Invalid syntax. Untangled:
create or replace function update_revisions()
returns trigger as
$$
declare
col_name information_schema.columns%ROWTYPE;
begin
for col_name in
select column_name from information_schema.columns
where table_name='t'
loop
insert into debug_table values (col_name);
end loop;
end;
$$ language plpgsql;
More problems
Table names are not unique in a Postgres database. More in this recent answer:
Behaviour of NOT LIKE with NULL valuesThe whole approach is inefficient. Use a single
INSERT
statement instead:
INSERT INTO debug_table (target_column) -- with column definition list!
SELECT column_name
FROM information_schema.columns
WHERE table_name = 't'
AND table_schema = 'public'; -- your schema