Thread: NOVICE - first time trigger and function

NOVICE - first time trigger and function

From
sam@edup.tudelft.nl (Sam)
Date:
Dear All,

I'm having trouble creating a function (it's my first time). First
I'll explain what I want to achieve:

I have two tables,I want to add a column to a table2 when a row is
inserted in table1. So i thought i could create a trigger and a
function: But I can't even get the function to do what I want. I tried
the following:

CREATE FUNCTION add_column (name) RETURNS BOOLEAN '
      ALTER TABLE table2 ADD COLUMN $1 integer
   ' LANGUAGE SQL;

I get the following error:

parser: parse error at or near "$1"

Anybody an idea?