pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alan Gutierrez <alangutierrez@hotmail.com>
Cc: Bill <bchie@opensys.com.hk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Re: DateDiff, IsNull?
Date: Tue, 14 Aug 2001 10:49:26 -0400
Message-ID: <17556.997800566@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.WNT.4.33.0108140634400.1680-100000@CX1198465-B>
References: <9lb25o$psq$1@news.tht.net>
	<Pine.WNT.4.33.0108140634400.1680-100000@CX1198465-B>

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



view thread (11+ messages)  latest in thread

Message-ID: <17556.997800566@sss.pgh.pa.us>
Permalink:  ../17556.997800566@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17556.997800566@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alangutierrez@hotmail.com, bchie@opensys.com.hk
  Subject: Re: Re: DateDiff, IsNull?
  In-Reply-To: <17556.997800566@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox