Received: from sss.pgh.pa.us ([216.151.103.158]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f3DIZr895771 for ; Fri, 13 Apr 2001 14:35:53 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.3/8.11.3) with ESMTP id f3DIZnR05180; Fri, 13 Apr 2001 14:35:49 -0400 (EDT) To: Lonnie Cumberland cc: Jan Wieck , pgsql-sql@postgresql.org Subject: Re: Calling plSQL functions In-reply-to: <20010412132354.46676.qmail@web12506.mail.yahoo.com> References: <20010412132354.46676.qmail@web12506.mail.yahoo.com> Comments: In-reply-to Lonnie Cumberland message dated "Thu, 12 Apr 2001 06:23:54 -0700" Date: Fri, 13 Apr 2001 14:35:49 -0400 Message-ID: <5177.987186949@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200104/206 X-Sequence-Number: 2556 Lonnie Cumberland 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