pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Eckermann <jeff_eckermann@yahoo.com>
To: David Loh <david@bizsurf.com>
To: pgsql-sql@postgresql.org
Subject: Re: Casting with character and character varying
Date: Wed, 19 Mar 2003 06:59:25 -0800 (PST)
Message-ID: <20030319145925.37042.qmail@web20802.mail.yahoo.com> (raw)
In-Reply-To: <007001c2edda$848c8410$b7d273cb@davidloh>

--- 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



view thread (3+ messages)

Message-ID: <20030319145925.37042.qmail@web20802.mail.yahoo.com>
Permalink:  ../20030319145925.37042.qmail@web20802.mail.yahoo.com/
Also on:    postgresql.org/message-id/20030319145925.37042.qmail@web20802.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jeff_eckermann@yahoo.com, david@bizsurf.com
  Subject: Re: Casting with character and character varying
  In-Reply-To: <20030319145925.37042.qmail@web20802.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox