Обсуждение: passing new/old record in pl/pgsql trigger functions to other functions
Hi, In Postgresql version 7.4.1 How does one pass new/old record in a pl/pgsql trigger function to other functions? I tried to pass it directly but the select/perform statement caused an error saying "NEW used in query that is not in a rule". I've tried 'rename' in the declare block but that didn't work at all (I get 'invalid column', which I assume it means rename did not work at all). Besides copying the record columns one by one, is there any other way to do this? -- basic
basic <basic@mozdev.org> writes: > In Postgresql version 7.4.1 How does one pass new/old record in a > pl/pgsql trigger function to other functions? You can't ... NEW and OLD are of unspecified-record types, and there's no support for passing such things to other functions. You pretty much have to do the tedious "myfunc(NEW.f1, NEW.f2, ...)". I've done some work recently to improve the support for passing record types around as full-fledged datatypes. The above still doesn't quite work, and I can't promise that it'll get done for 7.5, but hopefully by the release after that it will. regards, tom lane
hello look select * from pg_class where oid = 'sometablename'::regclass; (1 row) select * from pg_class where oid = 'sometablename'::text::regclass; ERROR can not cast TEXT to regclass What does this mean ? version 7.3.3 please try it on 7.4.x