Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Pavel Stehule
On Wed, 23 Feb 2005, Cristian Prieto wrote: > RETURNS SETOF Users gave me: > > getuser > - > (cristian,hola) > Yes, it's ok, but for SETOF function You have to use different style of calling SELECT * FROM getuser(...). If function call in normal centext then SRF function

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Cristian Prieto
RETURNS SETOF Users gave me: getuser - (cristian,hola) - Original Message - From: "Richard Huxton" To: "Pavel Stehule" <[EMAIL PROTECTED]> Cc: "Cristian Prieto" <[EMAIL PROTECTED]>; Sent: Wednesday, February 23, 2005 10:34

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Richard Huxton
Pavel Stehule wrote: If I did the following: SELECT * FROM "Users"; I get: userid | passwd --+ cristian | hola AND I execute: SELECT getuser('cristian', 'hola'); I get: getuser - (cristian,hola) There are two posibilities SELECT getuser('cristian','hola'); SELEC

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Pavel Stehule
> > If I did the following: > SELECT * FROM "Users"; > I get: > > userid | passwd > --+ > cristian | hola > > AND I execute: > SELECT getuser('cristian', 'hola'); > > I get: > getuser > - > (cristian,hola) > There are two posibilities SELECT getuser('cr

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Cristian Prieto
ot;Users" but inside a SP, how could I do it? - Original Message - From: "Jan Poslusny" To: "Cristian Prieto" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, February 23, 2005 8:36 AM Subject: Re: [GENERAL] Help with a very newbie question... 1. Plpgsql-function can retu

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Jan Poslusny
hanks a lot for your help... - Original Message - From: "Jan Poslusny" To: "Cristian Prieto" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, February 23, 2005 6:44 AM Subject: Re: [GENERAL] Help with a very newbie question... I think that sql-functions m

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Cristian Prieto
5 6:44 AM Subject: Re: [GENERAL] Help with a very newbie question... I think that sql-functions may serve as parametrized views for you... http://www.postgresql.org/docs/8.0/static/xfunc-sql.html Cristian Prieto wrote: I want to create a view or a sp which returns NULL if nothing is found and a re

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Jan Poslusny
I think that sql-functions may serve as parametrized views for you... http://www.postgresql.org/docs/8.0/static/xfunc-sql.html Cristian Prieto wrote: I want to create a view or a sp which returns NULL if nothing is found and a recordset if the user is found I wrote something like: CREATE sp_ge

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Sean Davis
On Feb 23, 2005, at 6:14 AM, Andre Schnoor wrote: CREATE sp_getuser(name, pass) RETURNS record AS $body$ DECLARE retval RECORD; BEGIN SELECT INTO retval * FROM Users WHERE userid=name AND passwd=pass; IF NOT FOUND THEN RETURN NULL; ELSE RETURN retval; END; $body$ LAN

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Andre Schnoor
>>> I wrote something like: CREATE sp_getuser(name, pass) RETURNS record AS $body$ DECLARE retval RECORD; BEGIN SELECT INTO retval * FROM Users WHERE userid=name AND passwd=pass; IF NOT FOUND THEN RETURN NULL; ELSE RETURN retval; END; $body$ LANGUAGE plpgsql; What

[GENERAL] Help with a very newbie question...

2005-02-22 Thread Cristian Prieto
I want to create a view or a sp which returns NULL if nothing is found and a recordset if the user is found   I wrote something like:   CREATE sp_getuser(name, pass) RETURNS record AS $body$ DECLARE     retval RECORD; BEGIN     SELECT INTO retval * FROM Users WHERE userid=name AND passwd=pass