Hello
I am thinking, so it isn't possible. There are a general datatype anyelement, but it cannot accept a second general type record.
CREATE TYPE p AS (a text, b int, c bool);
CREATE OR REPLACE FUNCTION fp(p)
RETURNS int AS $$
BEGIN RAISE NOTICE 'a = %', $1.a; RETURN $1.b;
END;
$$ LANGUAGE plpgsql;
postgres=# select fp(row('hello',10, false));
NOTICE: a = hello
fp
────
10
(1 row)
Regards
Pavel Stehule
Time: 0.814 ms
postgres=# select fp(row('hello',10, false));
2010/10/25 Greg
<grigorey@yahoo.co.uk>Hi guys, got across an interesting problem of passing params to a function in postgre: is it possible to pass a composite parameter to a function without declaring a type first?
For example:
// declare a function create function TEST ( object??? ) .... object???.paramName // using parameter ....
// calling perform TEST( ROW(string, int, bool, etc...) )
Or do I have to do the type declaration for that parameter?
Thanks!
|