pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Kretschmer <akretschmer@spamfence.net>
To: pgsql-sql@postgresql.org
Subject: Re: concatenate question
Date: Sat, 11 Dec 2010 14:42:59 +0100
Message-ID: <20101211134259.GA12385@tux> (raw)
In-Reply-To: <1291756033.16970.11.camel@tony1.localdomain>
References: <1291756033.16970.11.camel@tony1.localdomain>

Tony Capobianco <tcapobianco@prospectiv.com> wrote:

> Here's my table:
> 
> plsql_dw=# \d tmpsv_parent_master
>            Table "staging.tmpsv_parent_master"
> 
> 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.

You can read? ;-)

You have to CAST the INT and the TIMESTAMP both into a STRING-typ, for
instance:

test=*# select 1::int || now()::timestamp;
ERROR:  operator does not exist: integer || timestamp without time zone
ZEILE 1: select 1::int || now()::timestamp;
                       ^
TIP:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
test=!# rollback;
ROLLBACK
Zeit: 0,124 ms
test=# select 1::text || now()::text;
            ?column?
--------------------------------
 12010-12-11 14:42:12.571931+01
(1 Zeile)



Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°



view thread (11+ messages)

Message-ID: <20101211134259.GA12385@tux>
Permalink:  ../20101211134259.GA12385@tux/
Also on:    postgresql.org/message-id/20101211134259.GA12385@tux

 · 

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: akretschmer@spamfence.net
  Subject: Re: concatenate question
  In-Reply-To: <20101211134259.GA12385@tux>

* 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