Re: [GENERAL] How to define + operator for strings

2006-05-01 Thread Andrus
You can't really. There are 27 meanings for a binary '+' operator and it's not always easy to work out whats is going to if the underlying types are not numeric in some sense. So is the best way to create function CONCAT(s1, s2, ... s10) which returns concatenation in its arguments in both DBMS.

Re: [GENERAL] How to define + operator for strings

2006-04-28 Thread Geoffrey
Martijn van Oosterhout wrote: Does it not support the SQL standard way of string concatination? You should be planning a transition because text+text will cause problems down the line... Sounds to me like a job for sed, awk, perl, tr choose your conversion tool. Make the code right, don'

Re: [GENERAL] How to define + operator for strings

2006-04-28 Thread Martijn van Oosterhout
On Fri, Apr 28, 2006 at 07:35:20PM +0300, Andrus wrote: > > text + text will tend to capture ambiguous cases, > > and thus possibly break queries that used to work (date + integer is a > > case that comes to mind as being at risk). > > How to add + operator for strings so that date+integer expr

Re: [GENERAL] How to define + operator for strings

2006-04-28 Thread Andrus
> text + text will tend to capture ambiguous cases, > and thus possibly break queries that used to work (date + integer is a > case that comes to mind as being at risk). How to add + operator for strings so that date+integer expression is not broken ? > Refusing to deal with databases that ca

Re: [GENERAL] How to define + operator for strings

2006-04-28 Thread Tom Lane
"A. Kretschmer" <[EMAIL PROTECTED]> writes: > am 28.04.2006, um 12:59:25 +0300 mailte Andrus folgendes: >> How to define + operator as alias of || operator for strings > create function _string_plus(text, text) returns text as $$ > begin > return $1 || $2; > end; > $$ language plpgsql; >

Re: [GENERAL] How to define + operator for strings

2006-04-28 Thread A. Kretschmer
am 28.04.2006, um 12:59:25 +0300 mailte Andrus folgendes: > I want to create portable code which runs in other dbms without > modification. > > Unfortunately this other dbms uses + for string concatenation and has no way > to define operators. > > How to define + operator as alias of || operat

[GENERAL] How to define + operator for strings

2006-04-28 Thread Andrus
I want to create portable code which runs in other dbms without modification. Unfortunately this other dbms uses + for string concatenation and has no way to define operators. How to define + operator as alias of || operator for strings so I can use SELECT firstname+ ' '+ lastname ... in Pos