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

Re: Issue with PERFORM

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Yury Peskin" <ypeskin(at)cycle-inc(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Issue with PERFORM
Date: 2012-09-18 19:07:56
Message-ID: 5058803C020000250004A4B2@gw.wicourts.gov (view raw or flat)
Thread:
Lists: pgsql-novice
"Yury Peskin" <ypeskin(at)cycle-inc(dot)com> wrote:
 
> ERROR:  query has no destination for result data
> HINT:  If you want to discard the results of a SELECT, use 
> PERFORM instead.
> CONTEXT:  PL/pgSQL function "nm_create_friend" line 3 at 
> SQL statement
 
> CREATE FUNCTION nm_create_friend(user_id uuid, friend_id 
> text) RETURNS void
>     LANGUAGE plpgsql
>     AS $_$
> BEGIN
> SELECT f.friend_id
> FROM
> friends AS f
> WHERE f.user_id = $1 AND f.friend_id = $2;
> IF NOT FOUND THEN
> INSERT INTO friends (user_id, friend_id) values($1,$2);
> END IF;
> END;
> $_$;
 
> For some reason, psql thinks that PERFORM 
> NM_create_friend($1, friend_id); function is using a 
> SELECT.
 
No, it thinks that within the nm_create_friend() function there is a
SELECT which isn't assigning the value to anything.  And it's right.
It subsequently shows you where that function is being called from,
but that's not as relevant.
 
> Any ideas on how to fix this issue?
 
The HINT says it all.
 
-Kevin


In response to

Responses

pgsql-novice by date

Next:From: Tom BrowderDate: 2012-09-19 16:33:11
Subject: Upgrade and Single User
Previous:From: Yury PeskinDate: 2012-09-18 18:47:37
Subject: Issue with PERFORM

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group