![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
acc= CREATE OR REPLACE FUNCTION add_user (TEXT, TEXT, TEXT, TEXT) RETURNS usr AS $$ INSERT INTO usr (login,pass,name,email) VALUES ($1,$2,$3,$4) RETURNING usr.*; $$ LANGUAGE sql SECURITY DEFINER; acc= ERROR: return type mismatch in function declared to return usr DETAIL: Function's final statement must be a SELECT. CONTEXT: SQL function "add_user" SURPRISE :-) SURPRISE :-) |
#3
| |||
| |||
|
|
On 2010-02-17, silly sad<sad (AT) bankir (DOT) ru> wrote: acc= CREATE OR REPLACE FUNCTION add_user (TEXT, TEXT, TEXT, TEXT) RETURNS usr AS $$ INSERT INTO usr (login,pass,name,email) VALUES ($1,$2,$3,$4) RETURNING usr.*; $$ LANGUAGE sql SECURITY DEFINER; acc= ERROR: return type mismatch in function declared to return usr DETAIL: Function's final statement must be a SELECT. CONTEXT: SQL function "add_user" SURPRISE :-) SURPRISE :-) SQL functions are inlined when invoked, and so must be valid subselects. rewrite it in plpgsql. |
#4
| |||
| |||
|
|
On 02/17/10 13:51, Jasen Betts wrote: On 2010-02-17, silly sad<sad (AT) bankir (DOT) ru> Â*wrote: acc= CREATE OR REPLACE FUNCTION add_user (TEXT, TEXT, TEXT, TEXT) RETURNS usr AS $$ Â* Â*INSERT INTO usr (login,pass,name,email) VALUES ($1,$2,$3,$4) Â* Â*RETURNING usr.*; $$ LANGUAGE sql SECURITY DEFINER; acc= ERROR: Â*return type mismatch in function declared to return usr DETAIL: Â*Function's final statement must be a SELECT. CONTEXT: Â*SQL function "add_user" SURPRISE :-) SURPRISE :-) SQL functions are inlined when invoked, and so must be valid subselects. rewrite it in plpgsql. thanx for advice. may i ask? when this feature will be fixed? (now i am using 8.3.9) |
|
-- Sent via pgsql-sql mailing list (pgsql-sql (AT) postgresql (DOT) org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql |
#5
| |||
| |||
|
|
may i ask? when this feature will be fixed? (now i am using 8.3.9) |
#6
| |||
| |||
|
|
silly sad <sad (AT) bankir (DOT) ru> writes: may i ask? when this feature will be fixed? (now i am using 8.3.9) The example works fine for me in 8.4. |
|
regards, tom lane |
![]() |
| Thread Tools | |
| Display Modes | |
| |