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: [EMAIL PROTECTED]
w: http://www.woods-it.com



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl

Reply via email to