Thread: String concat issues in 8.3.1 (8.3.1 bug?)

String concat issues in 8.3.1 (8.3.1 bug?)

From
kevin kempter
Date:
I have a table as follows:

\d test_dim
                      Table "public.test_dim"
      Column      |            Type             |       Modifiers
-----------------+-----------------------------+------------------------
  customer_srcid  | bigint                      | not null
  segment_srcid      | bigint                      | not null
  show_name       | character varying(500)      | not null
  create_dt       | timestamp without time zone | not null default now()


I have this table in a db on an 8.2.6 cluster and in another db on an
8.3.1 cluster.

In both clusters I can do the following:


# select customer_srcid,  segment_srcid from test_dim;
  customer_srcid | segment_srcid
----------------+---------------
               1 |             1
               1 |             2
               1 |             3
               1 |
               1 |
               1 |
               1 |             1
               1 |             2
               1 |             3
               1 |
               1 |
               1 |
               1 |             1
               1 |             2
               1 |             3
               1 |
               1 |
               1 |
               1 |             1
               1 |             2
               1 |             3
               1 |
               1 |
               1 |
(24 rows)



In version 8.2.6 I can do this:

# select customer_srcid || segment_srcid from test_dim;
  ?column?
----------
  11
  12
  13



  11
  12
  13



  11
  12
  13



  11
  12
  13



(24 rows)




However in the 8.3.1 cluster I get this (Both clusters have the same
data set - via a pg_dump):

# select customer_srcid || segment_srcid from test_dim;
ERROR:  operator does not exist: bigint || bigint
LINE 1: select customer_srcid || segment_srcid from sl_segment_dim;
                               ^
HINT:  No operator matches the given name and argument type(s). You
might need to add explicit type casts.




Thoughts ?



Thanks in advance


/Kevin




Re: String concat issues in 8.3.1 (8.3.1 bug?)

From
Richard Huxton
Date:
kevin kempter wrote:
> I have a table as follows:
>
> \d test_dim
>                      Table "public.test_dim"
>      Column      |            Type             |       Modifiers
> -----------------+-----------------------------+------------------------
>  customer_srcid  | bigint                      | not null
>  segment_srcid      | bigint                      | not null
>  show_name       | character varying(500)      | not null
>  create_dt       | timestamp without time zone | not null default now()
>
>
> I have this table in a db on an 8.2.6 cluster and in another db on an
> 8.3.1 cluster.
>
> In both clusters I can do the following:
>
>
> # select customer_srcid,  segment_srcid from test_dim;
>  customer_srcid | segment_srcid
> ----------------+---------------
>               1 |             1
>               1 |             2
>               1 |             3
>               1 |
>               1 |
>               1 |

Are you sure the definition has "not null" on it?

> In version 8.2.6 I can do this:
>
> # select customer_srcid || segment_srcid from test_dim;
>  ?column?
> ----------
>  11
>  12
>  13

> However in the 8.3.1 cluster I get this (Both clusters have the same
> data set - via a pg_dump):
>
> # select customer_srcid || segment_srcid from test_dim;
> ERROR:  operator does not exist: bigint || bigint
> LINE 1: select customer_srcid || segment_srcid from sl_segment_dim;
>                               ^
> HINT:  No operator matches the given name and argument type(s). You
> might need to add explicit type casts.

Some of the implicit typecasting has been tightened up in 8.3 - try
casting to text first.

SELECT customer_srcid::text || segment_srcid::text ...

--
   Richard Huxton
   Archonet Ltd

Re: String concat issues in 8.3.1 (8.3.1 bug?)

From
"A. Kretschmer"
Date:
am  Thu, dem 17.04.2008, um  3:05:14 -0600 mailte kevin kempter folgendes:
> However in the 8.3.1 cluster I get this (Both clusters have the same
> data set - via a pg_dump):
>
> # select customer_srcid || segment_srcid from test_dim;
> ERROR:  operator does not exist: bigint || bigint
> LINE 1: select customer_srcid || segment_srcid from sl_segment_dim;
>                               ^
> HINT:  No operator matches the given name and argument type(s). You
> might need to add explicit type casts.
>
>
>
>
> Thoughts ?

You have to cast int-values to text, untested:

select customer_srcid::text || segment_srcid::text ...



Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net