Re: [GENERAL] [ask] Return Query

2009-03-16 Thread ataherster
thanks Tom Lane, my problem resolved, I'm trying to re-create my table and function, and this working well Tom Lane wrote: ataherster writes: ... but this function is not work with this error : ERROR: structure of query does not match function result type CONTEXT: PL/pgSQL function "pe

[Fwd: Re: [GENERAL] [ask] Return Query]

2009-03-15 Thread ataherster
--- Begin Message --- thanks Justin, my problem resolved, but i trying to re-create table and function, i'm using PGAdmin III to Create Script table and function before delete my table and function, after that I run Create Sript without change my script and working well my question is : wheth

Re: [GENERAL] [ask] Return Query

2009-03-15 Thread Tom Lane
ataherster writes: > ... but this function is not work with this error : > ERROR: structure of query does not match function result type > CONTEXT: PL/pgSQL function "penjualan" line 6 at RETURN QUERY This looks like a known limitation in plpgsql: it's not very good with rowtypes that contain

Re: [GENERAL] [ask] Return Query

2009-03-15 Thread Justin
ataherster wrote: hai all, i'm trying create function like this CREATE OR REPLACE FUNCTION penjualan(idcb integer) RETURNS SETOF penjualan AS but this function is not work with this error : ERROR: structure of query does not match function result type CONTEXT: PL/pgSQL function "penjualan

[GENERAL] [ask] Return Query

2009-03-14 Thread ataherster
hai all, i'm trying create function like this CREATE OR REPLACE FUNCTION penjualan(idcb integer) RETURNS SETOF penjualan AS $BODY$ BEGIN IF ($1 IS NULL) THEN return query SELECT * FROM PENJUALAN; ELSE return query SELECT * FROM PENJUALAN WHERE IDCABANG=$1; END IF; END; $BODY$ LANGUAGE 'plpg