Re: Re: DateDiff, IsNull?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alan Gutierrez <alangutierrez(at)hotmail(dot)com>
Cc: Bill <bchie(at)opensys(dot)com(dot)hk>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Re: DateDiff, IsNull?
Date: 2001-08-14 14:49:26
Message-ID: 17556.997800566@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Alan Gutierrez <alangutierrez(at)hotmail(dot)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 an explicit 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gary Stainburn 2001-08-14 15:12:32 Re: Re: Are circular REFERENCES possible ?
Previous Message Tom Lane 2001-08-14 14:40:14 Re: create function using language SQL