pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kenneth Marshall <ktm@rice.edu>
To: Tony Capobianco <tcapobianco@prospectiv.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: concatenate question
Date: Tue, 7 Dec 2010 15:52:20 -0600
Message-ID: <20101207215220.GF4028@aart.is.rice.edu> (raw)
In-Reply-To: <1291758466.16970.19.camel@tony1.localdomain>
References: <1291757825.16970.18.camel@tony1.localdomain>
	<AANLkTi=cdwqU0DtFf68BuD=wb3tWfCToe4hn_AUWJFpQ@mail.gmail.com>
	<1291758466.16970.19.camel@tony1.localdomain>

What does a 'timestamp || numeric' actually look like? It
means the timestamp written out a.k.a text and the same for
numeric. The database does not know that that is what you
wanted without the casts to text.

Cheers,
Ken

On Tue, Dec 07, 2010 at 04:47:46PM -0500, Tony Capobianco wrote:
> 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@prospectiv.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@postgresql.org)
> >         To make changes to your subscription:
> >         http://www.postgresql.org/mailpref/pgsql-sql
> > 
> > 
> > 
> > -- 
> > Peter Steinheuser
> > psteinheuser@myyearbook.com
> 
> 
> 
> -- 
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
> 



view thread (11+ messages)  latest in thread

Message-ID: <20101207215220.GF4028@aart.is.rice.edu>
Permalink:  ../20101207215220.GF4028@aart.is.rice.edu/
Also on:    postgresql.org/message-id/20101207215220.GF4028@aart.is.rice.edu

 · 

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: ktm@rice.edu, tcapobianco@prospectiv.com
  Subject: Re: concatenate question
  In-Reply-To: <20101207215220.GF4028@aart.is.rice.edu>

* 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