pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Lonnie Cumberland <lonnie_cumberland@yahoo.com>
Cc: Jan Wieck <JanWieck@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Calling plSQL functions
Date: Fri, 13 Apr 2001 14:35:49 -0400
Message-ID: <5177.987186949@sss.pgh.pa.us> (raw)
In-Reply-To: <20010412132354.46676.qmail@web12506.mail.yahoo.com>
References: <20010412132354.46676.qmail@web12506.mail.yahoo.com>

Lonnie Cumberland <lonnie_cumberland@yahoo.com> writes:
> I have then created a PL/pgSQL function called "register_user()" in a file
> called register.sql

> create function register_user(text,text,text,text,text,text,text,text,text)
> [snip] 
> begin
 
>     -- Look to see if the login is already taken
>     select * from user_info where login = client_login;

> ERROR:  unexpected SELECT query in exec_stmt_execsql()

The error message isn't very helpful, but the issue here is that you're
doing a completely useless SELECT --- or at least plpgsql thinks it's
useless, because you're discarding the result.  (I think that plpgsql is
being overly anal-retentive about it, since such a query might indeed be
useful if you then examine FOUND or ROW_COUNT, but that's the issue at
the moment.)  Try making it a SELECT INTO instead.

			regards, tom lane



view thread (10+ messages)  latest in thread

Message-ID: <5177.987186949@sss.pgh.pa.us>
Permalink:  ../5177.987186949@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5177.987186949@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, lonnie_cumberland@yahoo.com, JanWieck@yahoo.com
  Subject: Re: Calling plSQL functions
  In-Reply-To: <5177.987186949@sss.pgh.pa.us>
  References: <20010412132354.46676.qmail@web12506.mail.yahoo.com> <5177.987186949@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox