Hello I propose two kinds of functions:
a) generic functions - this function allows any params without any implicit casting (it can implemented only in C language). This function have to have specified return type. It usable for constructor function and for some other. It allows unspecified number of params without parser changes. There are not limits for params (only max number) and there are not any implicit casting. Any parameter can take additional tag with AS keyword. Limits: only one function with specified name can exists in schema. Sample: CREATE FUNCTION format(any) RETURNS text LANGUAGE C ....; SELECT format(1, 'aaa' AS b, ARRAY[1,2,3]) -> '(1, b:"aaa",[1,2,3])' generic function can be well used for constructor function b) constructor function - this function returns typed composite or array value. It's in conformance with ANSI SQL. Constructor function is any generic function where name is same like any composite type or domain. Behave of constructor is same for all types. Sample: CREATE TYPE ftype AS (a integer, b integer); SELECT ftype(), ftype(10), ftype(10,20); -> (NULL, NULL), (10,NULL), (10,20) ~ (10,20)::ftype CREATE DOMAIN fdom AS int[]; SELECT fdom(), fdom(10,20,30); -> '{}','{10,20,30}'; ~ it's eq ARRAY[10,20,30]::int[]; Why constructors? Composite values are referenced in SQL/PSM. When I wont to fill composite variables directly, I have to call constructor before: DECLARE v mytype; SET v = mytype(); SET v.f = 10; ~ or shortly SET v = mytype(10); Any comments are welcome Regards Pavel Stehule ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend