Re: concatenate question

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Tony Capobianco <tcapobianco(at)prospectiv(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: concatenate question
Date: 2010-12-07 21:51:20
Message-ID: AANLkTinB_-i+TPE4QNU7pXpka+Za09qZgO9kJbHsSRWa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hey Tony,

Because there is no implicit conversion to text.

2010/12/8 Tony Capobianco <tcapobianco(at)prospectiv(dot)com>

> Ok, that worked. Why did I need to cast both as text though?
>
> plsql_dw=# select memberid::text||addeddate::text from
> tmpsv_parent_master limit 5;
> ?column?
> ------------------------------
> 4005941032010-11-16 19:32:17
> 4005941952010-11-16 19:33:29
> 4005942842010-11-16 19:34:32
> 4005943492010-11-16 19:35:22
> 4005943662010-11-16 19:35:37
> (5 rows)
>
> Thanks.
>
> On Tue, 2010-12-07 at 16:43 -0500, Peter Steinheuser wrote:
> > I think the HINT is what you need to look at.
> >
> > Cast both columns to text.
> >
> > On Tue, Dec 7, 2010 at 4:37 PM, Tony Capobianco
> > <tcapobianco(at)prospectiv(dot)com> wrote:
> > Here's my table:
> >
> > plsql_dw=# \d tmpsv_parent_master
> > Table "staging.tmpsv_parent_master"
> > Column | Type |
> > Modifiers
> >
> > ----------------+-----------------------------+-----------
> > memberid | numeric |
> > addeddate | timestamp without time zone |
> > sourceid | numeric |
> > regcomplete | numeric(1,0) |
> > optoutdate | date |
> > bouncedate | date |
> > websiteid | numeric |
> > emailbounced | numeric(2,0) |
> > emailok | numeric(2,0) |
> > emailaddress | character varying(50) |
> > srcwebsiteid | numeric |
> > srcmemberid | numeric |
> > sitetype | character varying |
> > commissionpct | numeric |
> > pricepermember | numeric |
> > acceptrate | numeric(3,2) |
> > mktgcenterid | numeric |
> > label | character varying(32) |
> >
> >
> > Why won't this work?
> > plsql_dw=# select memberid || addeddate from
> > tmpsv_parent_master
> > limit
> > 10;
> > ERROR: operator does not exist: numeric || timestamp
> > without
> > time zone
> > LINE 1: select memberid || addeddate from
> > tmpsv_parent_master
> > limit ...
> > ^
> > HINT: No operator matches the given name and argument
> > type(s).
> > You
> > might need to add explicit type casts.
> >
> > Thanks.
> >
> >
> > --
> > Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-sql
> >
> >
> >
> > --
> > Peter Steinheuser
> > psteinheuser(at)myyearbook(dot)com
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

--
// Dmitriy.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Kenneth Marshall 2010-12-07 21:52:20 Re: concatenate question
Previous Message Tony Capobianco 2010-12-07 21:47:46 Re: concatenate question