[SQL] Function returns error (view) (RESOLVED)

2008-03-01 Thread Professor Flávio Brito
Hi I discovered that when a person did not change the password, there is no information into change_user_password table, then a exception raise but wasn't treated. Now it is OK. Thanks for all CREATE OR REPLACE FUNCTION seach_password(USER_FOO varchar(100)) RETURNS SETOF vw_change_password AS

Re: [SQL] Function returns error (view) (RESOLVED)

2008-02-28 Thread Professor Flávio Brito
Hi I discovered that when a person did not change the password, there is no information into change_user_password table, then a exception raise but wasn't treated. Now it is OK. Thanks for all CREATE OR REPLACE FUNCTION seach_password(USER_FOO varchar(100)) RETURNS SETOF vw_change_password AS

Re: [SQL] Function returns error (view)

2008-02-27 Thread Bart Degryse
Please send the complete DDL for your function and the tables it uses. Also inform us of the database version you're using. >>> "Professor Flávio Brito" <[EMAIL PROTECTED]> 2008-02-27 21:42 >>> Hi After I did it I received it SELECT * FROM search_password('Paul'); ERROR: set-valued functi

Re: [SQL] Function returns error (view)

2008-02-27 Thread Professor Flávio Brito
Hi After I did it I received it SELECT * FROM search_password('Paul'); ERROR: set-valued function called in context that cannot accept a set SQL state: 0A000 Context: PL/pgSQL function "search_password(" line 14 at return next Error at WHERE login= Paul ?? Thanks for your help Flávio 2008/

Re: [SQL] Function returns error (view)

2008-02-27 Thread Markus Bertheau
2008/2/27, Bart Degryse <[EMAIL PROTECTED]>: > > > For rather "simple" queries like this one PostgreSQL indeed seems to be > quite smart. > I have quite a lot of statements where it does make a difference though > (PostgreSQL 8.2.4). I would rather find a situation where an explicit join is planne

Re: [SQL] Function returns error (view)

2008-02-27 Thread Bart Degryse
For rather "simple" queries like this one PostgreSQL indeed seems to be quite smart. I have quite a lot of statements where it does make a difference though (PostgreSQL 8.2.4). As long as I have one statement where it makes a difference I will use the join rather than the IN(subselect) just to b

Re: [SQL] Function returns error (view)

2008-02-27 Thread Markus Bertheau
2008/2/27, Bart Degryse <[EMAIL PROTECTED]>: > > I would also suggest you replace the > ...t.cod_user IN (subselect) > by a join construction. I think it's more performant. In recent versions PostgreSQL is quite smart when planning IN, so that shouldn't be a concern. Markus -- Markus Bertheau B

Re: [SQL] Function returns error (view)

2008-02-26 Thread Bart Degryse
How do you call your function? You should call it like this: SELECT * FROM seach_password('Flavio'); Replace Flavio with the login of someone in table_user. Also watch out for the function name: if you copied my suggestion it is seach_... and not search_... I would also suggest you replace the

Re: [SQL] Function returns error (view)

2008-02-26 Thread Professor Flávio Brito
Hi After I did it I received it ERROR: set-valued function called in context that cannot accept a set SQL state: 0A000 Context: PL/pgSQL function "seach_password(" line 14 at return next Error at WHERE login= USER_FOO ?? Thanks for your help Flávio 2008/2/26, Bart Degryse <[EMAIL PROTECTED]>:

Re: [SQL] Function returns error (view)

2008-02-26 Thread Bart Degryse
I think you have a quoting problem You want something like WHERE login= 'Flavo' But you're making something like WHERE login = Flavo Something like this should work... CREATE OR REPLACE FUNCTION seach_password(USER_FOO IN table_user.login%TYPE) RETURNS SETOF vw_change_password AS $BODY$ DECL

Re: [SQL] Function returns error (view)

2008-02-26 Thread Professor Flávio Brito
Hi Colin When I translated from Portuguese to English I forgot a letter, but using the corrected name I received an error. 2008/2/26, Colin Wetherbee <[EMAIL PROTECTED]>: > > Professor Flávio Brito wrote: > > When I Test my view I receive > > > > SELECT seach_password('user_login_foo') > > [

Re: [SQL] Function returns error (view)

2008-02-26 Thread Colin Wetherbee
Professor Flávio Brito wrote: When I Test my view I receive SELECT seach_password('user_login_foo') [...] ERROR: column "user_login_foo" does not exist SQL state: 42703 Context: PL/pgSQL function "search_password" line 14 at for over execute statement seach_password and search_password are

[SQL] Function returns error (view)

2008-02-26 Thread Professor Flávio Brito
Hi Don't know why I can't receive a return like my view fields (I'm newbie in plpgsql). Postgresql returns me a erro . How can I received a answer like my view structure? When I Test my view I receive SELECT seach_password('user_login_foo') My view returns me 25746;"MARCELO ";"bio1";"bio1";"2

Re: [SQL] Function returns error

2004-06-10 Thread Richard Huxton
Michael Long wrote: ERROR: operator does not exist: character varying == "unknown" HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. CONTEXT: PL/pgSQL function "building_insert" line 14 at if Common mistake, still make it myself on occasion.

[SQL] Function returns error

2004-06-10 Thread Michael Long
Hi All, I am a relatively new user to postgres. I have created a function that compiles but generates an error when executed. I know I am overlooking something simple. The function and error are below. CREATE OR REPLACE FUNCTION building_insert(varchar, int4, varchar) RETURNS int4 AS ' /* Retu