Re: Casting with character and character varying - Mailing list pgsql-sql

From Jeff Eckermann
Subject Re: Casting with character and character varying
Date
Msg-id 20030319145925.37042.qmail@web20802.mail.yahoo.com
Whole thread Raw
In response to Casting with character and character varying  ("David Loh" <david@bizsurf.com>)
List pgsql-sql
--- David Loh <david@bizsurf.com> wrote:
>   else
>   select into Rec * from tableA where user_name =
> trim(trailing '' '' from
> cast(NEW.user_name as varchar)) and user_type =
> ''T'';
>    if not found then
>     return NEW;
>    end if;
> 
>    insert into temptable values (tableA.FieldA);

This last statement inserts every record from tableA
into temptable.  This follows from the PostgreSQL
"implicit from-clause" feature, whereby "select
tableA.FieldA" is equivalent to "select FieldA from
tableA".

What you want is to refer to "Rec.FieldA", which will
give you the single value that you are looking for.

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com


pgsql-sql by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: vacuum all but system tables
Next
From: Victor Yegorov
Date:
Subject: Re: vacuum all but system tables