Re: [GENERAL] FUNCTION returns SETOF

2006-05-23 Thread Tom Lane
Rafal Pietrak <[EMAIL PROTECTED]> writes: > CREATE FUNCTION new_user (text,text) RETURNS SETOF people AS $$ > CREATE ROLE $1 PASSWORD $2; > SELECT CASE WHEN $2 is not null THEN ROW($1, null, null, null)::people > ELSE null::ludzie END > $$ language sql; > "ERROR: function returning

[GENERAL] FUNCTION returns SETOF

2006-05-23 Thread Rafal Pietrak
Hi All, The original reason I tied FUNCTIONS is that I need to extend ROLE definition as stored within pg_authid system table, with some (more or less arbitrary) user preferencies profile. At this point, the task comes down to the point where I can imagine having an additional table PEOPLE(rolena

[GENERAL] function returns setof column type problems

2006-02-01 Thread mmuurr[AT]gmail.com
hi all, i'm trying to figure out how to get the following test situation to work: creating a function like below fails... => CREATE FUNCTION test_function() RETURNS SETOF table.column%TYPE AS $$ SELECT 1; $$ LANGUAGE SQL; ERROR: syntax error at or near "%" at character 59 LINE 1: ...ate functio

[GENERAL] Function RETURNS SETOF ???

2001-06-04 Thread Thalis A. Kalfigopoulos
Helloppl, I have a long query that (summerized) looks something like: SELECT A.a,B.b FROM A,B WHERE A.x=B.x AND (A.y=const1 OR A.y=const2 OR A.y=const3); where the user provides const1,2,3 at runtime. The problem is in creating a function out of it: CREATE FUNCTION myfunc(int4,int4,int4) RETUR