Re: text + text

From: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: text + text
Date: 2004-10-08 13:16:45
Message-ID: 4166933D.9080308@zara.6.isreserved.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Eisentraut wrote:
>>What is "text + text" supposed to do right now?
>
> Nothing.

Then are these bugs? (7.4.5 and 8.0.0beta1 give same results). Frankly,
the current behaviour is quite strange to me.

------------------
=# select coalesce('1'+'0','NULL');
a
=# select coalesce('1'+'1','NULL');
b
=# select coalesce('1'+'3','NULL');
d
=# select coalesce('a'+'0','NULL');

=# select coalesce('a'+'1','NULL');

=# select coalesce('a'+'3','NULL');

=# select coalesce('a'+'x','NULL');
Ù
------------------

>>What about making "text + text" as an equivalent for "text
>>|| text"? Most strongly-typed programming languages do this. And MS SQL
>>Server too, I think (CMIIW).
>
> What would this gain except for bloat? It's not like SQL is utterly
> compatible with any programming language; users will still have to learn all
> the operators anyway.

I personally don't consider this "bloat". We already have other synonyms
like '!=' and '<>'. '+' is very natural to mean concatenation for strings.

Anyway, either emitting an error or string concatenation is better than
the current behaviour, I think.

--
dave

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Garamond 2004-10-08 13:19:26 Re: when to use NULL and when to NOT NULL DEFAULT ''
Previous Message Peter Eisentraut 2004-10-08 12:41:23 Re: text + text