Re: Question about function

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Bruno Lopes <blvieira(at)pcsolution(dot)com(dot)br>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Question about function
Date: 2002-03-14 15:49:35
Message-ID: 20020314074843.L433-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 13 Mar 2002, Bruno Lopes wrote:

> Hello list.
> That might sound very lame but I am new to postgres.
> I was looking into the postgres guide and trying to make a function to make an insert to a table.
> but postgres returns me an error in the RETURN of the function
>
> query is:
> CREATE FUNCTION test() RETURNS bool AS 'INSERT INTO b (nome) VALUES (\'PQP\');' LANGUAGE 'sql';
> >> function declared to return type bool, but final query is not a retrieve
>
> obviously my return type is incorrect... so what should I use?

I think you need to end an sql language function with a select of some
sort (even if it's just say select true;)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2002-03-14 15:51:34 Re: Select not using primary key index
Previous Message Doug McNaught 2002-03-14 15:49:13 Re: JDBC Prepared Statement Bug