Re: How to define + operator for strings

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Andrus <eetasoft(at)online(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to define + operator for strings
Date: 2006-04-28 19:45:39
Message-ID: 20060428194539.GD15566@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 expression is not
> broken ?

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. Given you're using a system that's
not standards compliant, it would surprise me if you used date+integer
at all.

> > Refusing to deal with databases that can't handle the 14-year-old SQL
> > standard spelling of concatenation would be a better plan IMHO --- if
> > they can't get this right, it's unlikely that they are much better on
> > a lot of other points that will be harder to work around.
>
> I have huge amount of code written for this. Refusing is difficult.

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

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jessica M Salmon 2006-04-28 19:47:59 file I/O in plpgsql
Previous Message Jim Buttafuoco 2006-04-28 19:42:29 Re: Autovacuum Logging