f



text + text

What is "text + text" supposed to do right now? It doesn't seem very 
useful to me. 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).

-- 
dave


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

0
lists
10/8/2004 10:57:05 AM
comp.postgresql.general 5128 articles. 0 followers. Post Follow

4 Replies
6776 Views

Similar Articles

[PageSpeed] 43

Am Freitag, 8. Oktober 2004 12:57 schrieb David Garamond:
> What is "text + text" supposed to do right now?

Nothing.

> 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.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

0
peter_e
10/8/2004 12:41:23 PM
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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

0
lists
10/8/2004 1:16:45 PM
On Fri, 8 Oct 2004, David Garamond wrote:

> 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

That isn't text+text.  It's "char"+"char". "char" is a rather bizarre type
being partially 1 byte integer and partially 1 character string and it
causes strange behaviors like the above where I believe it's taking the
first bytes of the '1' and '0' and adding them together. I think Tom was
talking about removing the math operators from it so that things like the
above don't happen.


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

0
sszabo
10/8/2004 1:31:31 PM
David Garamond <lists@zara.6.isreserved.com> writes:
> 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.

CVS tip gives

regression=# select coalesce('1'+'0','NULL');
ERROR:  operator is not unique: "unknown" + "unknown"
HINT:  Could not choose a best candidate operator. You may need to add explicit type casts.
regression=#

See http://archives.postgresql.org/pgsql-hackers/2004-10/msg00041.php

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

0
tgl
10/8/2004 2:16:42 PM
Reply: