Re: Re: DateDiff, IsNull?

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
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 15:34:51
Message-ID: 20010814103451.A15790@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Aug 14, 2001 at 06:51:33AM +0000, Alan Gutierrez wrote:
>
> Overloading operators? *Please* tell me that this is impossible.

Well, Alan, overloading operators is sort of important to the user
definable types in postgresql. And any cross-type functionality, actually.

Bill's original question was looking for 'text1' + 'text2' to mean
concatentation. The right (SQL92) spelling for that is:

'text1' || 'text2'

Currently, since there is no '+' operator for the types 'text' and
'text', you probably could define it as a synonym for ||. I wouldn't
expect your code to be very portable that way, but it might work. (BTW,
as written above, with string constants (type 'unknown'), the type
promotion system kicks in and turns the strings into 'char', I believe,
which it then adds the raw values of the first character, and produces
'' (sorry about the 8-bit character))

Check the manuals for 'CREATE OPERATOR', then grovel through the
pg_operator table to figure out what all you'd need to hand it for
procedure names, etc.

Ross

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Manuel Sugawara 2001-08-14 16:00:07 Re: Re: DateDiff, IsNull?
Previous Message Josh Berkus 2001-08-14 15:30:00 Re: [SQL] Re: Arithmetic operation on DATE