Re: PL/PGSQL - character varying as function argument - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: PL/PGSQL - character varying as function argument
Date
Msg-id 48DCE689.6030107@iol.ie
Whole thread Raw
In response to PL/PGSQL - character varying as function argument  ("Chris Baechle" <bangular@gmail.com>)
Responses Re: PL/PGSQL - character varying as function argument
List 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@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: ]OT] Database structure question
Next
From: Tom Lane
Date:
Subject: Re: PL/PGSQL - character varying as function argument