Re: Re: DateDiff, IsNull? - Mailing list pgsql-sql

From Tom Lane
Subject Re: Re: DateDiff, IsNull?
Date
Msg-id 17556.997800566@sss.pgh.pa.us
Whole thread Raw
In response to Re: DateDiff, IsNull?  (Alan Gutierrez <alangutierrez@hotmail.com>)
List pgsql-sql
Alan Gutierrez <alangutierrez@hotmail.com> writes:
> On Tue, 14 Aug 2001, Bill wrote:
>> And is it possible to override the existing function and
>> operator like "+" to become a concate?

> Overloading operators? *Please* tell me that this is impossible.

I've got bad news ;-) ... it's pretty easy.

regression=# select 'aa'::text + 'bb'::text;
ERROR:  Unable to identify an operator '+' for types 'text' and 'text'       You will have to retype this query using
anexplicit cast
 

regression=# create operator + (procedure = textcat,
regression(# leftarg = text, rightarg = text);
CREATE

regression=# select 'aa'::text + 'bb'::text;?column?
----------aabb
(1 row)

Whether this is a good idea is another question --- but if Bill's
intent on not using the SQL-standard text concatenation operator "||",
he can do so.
        regards, tom lane


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: create function using language SQL
Next
From: Manuel Sugawara
Date:
Subject: Re: Re: DateDiff, IsNull?