By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,777 Members | 1,755 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,777 IT Pros & Developers. It's quick & easy.

text + text

P: n/a
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 ma*******@postgresql.org

Nov 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

Nov 23 '05 #2

P: n/a
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 ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3

P: n/a
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 ma*******@postgresql.org

Nov 23 '05 #4

P: n/a
David Garamond <li***@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...0/msg00041.php

regards, tom lane

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

Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.