pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedChange in behavior of string concat operator
6+ messages / 3 participants
[nested] [flat]
* Change in behavior of string concat operator
@ 2008-12-06 18:04 Benjamin Krajmalnik <kraj@illumen.com>
0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Krajmalnik @ 2008-12-06 18:04 UTC (permalink / raw)
To: pgsql-admin
I just migrated from 8.1 to 8.3, running on FreeBSD 7.0 amd64.
Running 8.3.5
I have a query concatenating 3 columns to create a hash.
userid is a numeric(38,0) field, accountno is an integer, and
requestdate is a date.
Under 8.1, Select userid || accountno || requestdate::date as newcolumn
from table executed ok.
Under 8.3, it gives the following error:
operator does not exist: numeric || integer
Typecasting the first two columns to varchar resolved the problem.
Select userid::varchar || accountno::varchar || requestdate::date as
newcolumn from table
At the very least, the documentation should be updated to reflect the
new behavior, although I believe this is a bug.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Change in behavior of string concat operator
@ 2008-12-06 19:49 Milen A. Radev <milen@radev.net>
parent: Benjamin Krajmalnik <kraj@illumen.com>
0 siblings, 1 reply; 6+ messages in thread
From: Milen A. Radev @ 2008-12-06 19:49 UTC (permalink / raw)
To: pgsql-admin
Benjamin Krajmalnik написа:
> I just migrated from 8.1 to 8.3, running on FreeBSD 7.0 amd64.
> Running 8.3.5
[...]
> Select userid::varchar || accountno::varchar || requestdate::date as
> newcolumn from table
> At the very least, the documentation should be updated to reflect the
> new behavior, although I believe this is a bug.
http://www.postgresql.org/docs/current/static/release-8-3.html#AEN86272
--
Milen A. Radev
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Change in behavior of string concat operator
@ 2008-12-08 16:28 Benjamin Krajmalnik <kraj@illumen.com>
parent: Milen A. Radev <milen@radev.net>
0 siblings, 2 replies; 6+ messages in thread
From: Benjamin Krajmalnik @ 2008-12-08 16:28 UTC (permalink / raw)
To: Milen A. Radev <milen@radev.net>; pgsql-admin
Thanks.
Then we have an inconsistency between this and the documentation for the || operator, where it is showing the abilty to concat numeric types without explicit casting.
http://www.postgresql.org/docs/8.3/static/functions-string.html
> -----Original Message-----
> From: pgsql-admin-owner@postgresql.org
> [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Milen A. Radev
> Sent: Saturday, December 06, 2008 12:49 PM
> To: pgsql-admin@postgresql.org
> Subject: Re: [ADMIN] Change in behavior of string concat operator
>
> Benjamin Krajmalnik написа:
> > I just migrated from 8.1 to 8.3, running on FreeBSD 7.0 amd64.
> > Running 8.3.5
> [...]
> > Select userid::varchar || accountno::varchar ||
> requestdate::date as
> > newcolumn from table At the very least, the documentation should be
> > updated to reflect the new behavior, although I believe
> this is a bug.
>
>
> http://www.postgresql.org/docs/current/static/release-8-3.html
> #AEN86272
>
>
>
> --
> Milen A. Radev
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Change in behavior of string concat operator
@ 2008-12-08 16:57 Milen A. Radev <milen@radev.net>
parent: Benjamin Krajmalnik <kraj@illumen.com>
1 sibling, 0 replies; 6+ messages in thread
From: Milen A. Radev @ 2008-12-08 16:57 UTC (permalink / raw)
To: pgsql-admin
Benjamin Krajmalnik написа:
> Thanks.
>
> Then we have an inconsistency between this and the documentation for the || operator, where it is showing the abilty to concat numeric types without explicit casting.
>
> http://www.postgresql.org/docs/8.3/static/functions-string.html
On second reading of your post (and the documentation) we are both wrong
- the _string_ concatenation operator works when at least one of the
operands is a string.
>
>> -----Original Message-----
>> From: pgsql-admin-owner@postgresql.org
>> [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Milen A. Radev
>> Sent: Saturday, December 06, 2008 12:49 PM
>> To: pgsql-admin@postgresql.org
>> Subject: Re: [ADMIN] Change in behavior of string concat operator
>>
>> Benjamin Krajmalnik написа:
>>> I just migrated from 8.1 to 8.3, running on FreeBSD 7.0 amd64.
>>> Running 8.3.5
>> [...]
>>> Select userid::varchar || accountno::varchar ||
>> requestdate::date as
>>> newcolumn from table At the very least, the documentation should be
>>> updated to reflect the new behavior, although I believe
>> this is a bug.
>>
>>
>> http://www.postgresql.org/docs/current/static/release-8-3.html
>> #AEN86272
[...]
--
Milen A. Radev
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Change in behavior of string concat operator
@ 2008-12-08 16:57 Stephan Szabo <sszabo@megazone.bigpanda.com>
parent: Benjamin Krajmalnik <kraj@illumen.com>
1 sibling, 1 reply; 6+ messages in thread
From: Stephan Szabo @ 2008-12-08 16:57 UTC (permalink / raw)
To: Benjamin Krajmalnik <kraj@illumen.com>; +Cc: Milen A. Radev <milen@radev.net>; pgsql-admin
On Mon, 8 Dec 2008, Benjamin Krajmalnik wrote:
> Thanks.
>
> Then we have an inconsistency between this and the documentation for the
> || operator, where it is showing the abilty to concat numeric types
> without explicit casting.
>
> http://www.postgresql.org/docs/8.3/static/functions-string.html
What that page appears to say in the note and table is that you can
concatenate a string and a non-string like varchar and integer, not
multiple non-strings like numeric and integer. What specifically were you
looking at on the page?
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Change in behavior of string concat operator
@ 2008-12-08 17:09 Benjamin Krajmalnik <kraj@illumen.com>
parent: Stephan Szabo <sszabo@megazone.bigpanda.com>
0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Krajmalnik @ 2008-12-08 17:09 UTC (permalink / raw)
To: Stephan Szabo <sszabo@megazone.bigpanda.com>; +Cc: pgsql-admin
Thanks, Stephan and Milen.
Everything is clear now.
I had a change in the behavior moving from 8.1 to 8.3, and the automatic
typecasting prior to 8.3 blurred the intended behavior as per the
documentation.
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2008-12-08 17:09 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-12-06 18:04 Change in behavior of string concat operator Benjamin Krajmalnik <kraj@illumen.com>
2008-12-06 19:49 ` Milen A. Radev <milen@radev.net>
2008-12-08 16:28 ` Benjamin Krajmalnik <kraj@illumen.com>
2008-12-08 16:57 ` Milen A. Radev <milen@radev.net>
2008-12-08 16:57 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
2008-12-08 17:09 ` Benjamin Krajmalnik <kraj@illumen.com>
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