Re: Casting with character and character varying

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: David Loh <david(at)bizsurf(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Casting with character and character varying
Date: 2003-03-19 14:59:25
Message-ID: 20030319145925.37042.qmail@web20802.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

--- David Loh <david(at)bizsurf(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Victor Yegorov 2003-03-19 15:02:42 Re: vacuum all but system tables
Previous Message Tomasz Myrta 2003-03-19 14:53:56 Re: vacuum all but system tables