Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: very frustrating feature-bug


  • From: silly sad <sad(at)bankir(dot)ru>
  • Cc: pgsql-sql(at)postgresql(dot)org
  • Subject: Re: very frustrating feature-bug
  • Date: Wed, 17 Feb 2010 14:34:25 +0300
  • Message-id: <4B7BD441.1080201@bankir.ru> <text/plain>

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)




Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group