Re: My second PL/pgSQL function - minor problem
От | A. Kretschmer |
---|---|
Тема | Re: My second PL/pgSQL function - minor problem |
Дата | |
Msg-id | 20091118161847.GA3319@a-kretschmer.de обсуждение исходный текст |
Ответ на | My second PL/pgSQL function - minor problem (Thomas Løcke <thomas.granvej6@gmail.com>) |
Список | pgsql-novice |
In response to Thomas Løcke : > Hey all, > > http://pastebin.com/f1015226d > > The above function appears to be doing exactly what I want: Fetch the users > data and update the visits column, if the supplied credentials match a user. > > My problem is what happens when the credentials don't match a user. In those > cases I would like to have a boolean false returned, but instead I get an empty > array - which of course is entirely according to the functions "RETURN SETOF > users" statement. > > Is this little problem solvable, or will I have to learn to live with the empty > array? You can't return different return-types. Either return forever a record or an bool. But you can use select exists( select * from log_in( ...) ) to get true/false it there a user or not. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
В списке pgsql-novice по дате отправления: