Re: PL/PGSQL - character varying as function argument

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Chris Baechle <bangular(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PL/PGSQL - character varying as function argument
Date: 2008-09-26 13:41:29
Message-ID: 48DCE689.6030107@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 26/09/2008 14:35, Chris Baechle wrote:

> CREATE OR REPLACE FUNCTION user_checkCredentials(character varying)
> RETURNS character varying AS
> $BODY$
> DECLARE
> username ALIAS FOR $1;
> permission record;
> BEGIN
> select into permission permtype from users;
> RETURN permission.permtype;

You're missing the "where" clause from the query - it should be:

select into permission permtype from users
where uid = username;

...where uid is the name of the appropriate column in your users table.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-09-26 13:47:40 Re: PL/PGSQL - character varying as function argument
Previous Message Stephan Szabo 2008-09-26 13:40:00 Re: PL/PGSQL - character varying as function argument