"Steve South" <steve(dot)south(at)blueyonder(dot)co(dot)uk> writes:
> ERROR: record "old" has no field "userid"
I think you're just being sloppy about capitalization:
> OLD."UserId",
> "UserID" int4 NOT NULL DEFAULT nextval('public."UserT_UserID_seq"'::text),
"UserID" != "UserId".
Also, the error message suggests strongly that you didn't double-quote
the name in at least one place in the trigger, so that it got folded
to lower case.
regards, tom lane