From: | Micah Woods <micah(at)woods-it(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Trigger won't accept function (Please Help) |
Date: | 2001-04-26 16:59:01 |
Message-ID: | B70DCC14.1034%micah@woods-it.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I've created a plpgsql function that takes 2 args as follows:
CREATE FUNCTION insert_default(text,text) RETURNS OPAQUE AS 'BEGIN new.$2 =
new.$1; RETURN new; END;' LANGUAGE 'plpgsql';
When I try to reference this function when creating a trigger:
CREATE TRIGGER "iep_district_insert" BEFORE INSERT ON "iep_district" FOR
EACH ROW EXECUTE PROCEDURE insert_default('id_author','id_author_last_mod');
I get this error: PostgreSQL said: ERROR: CreateTrigger: function
insert_default() does not exist
Questions:
1. I can ONLY reference functions in triggers that have NO args, any
function (like above example) that takes 1 or more args always gets the does
not exist error.
2. I'm new to postgres, perhaps there's a better way have the default value
of a field be that of another field??
Thanks for any help,
Micah
--
Micah Woods
Woods/IT LLC
2214 Waite Ave.
Kalamazoo, MI 49008
v: 616 349-1175
f: 877 349-4929 (toll free)
e: micah(at)woods-it(dot)com
w: http://www.woods-it.com
From | Date | Subject | |
---|---|---|---|
Next Message | Loïc Courtois | 2001-04-26 17:07:42 | JDBC problem & 7.1 |
Previous Message | John Burski | 2001-04-26 16:47:18 | Re: using POSTGRES in a network |