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

From Ross J. Reedstrom
Subject Re: Re: DateDiff, IsNull?
Date
Msg-id 20010814103451.A15790@rice.edu
Whole thread Raw
In response to Re: DateDiff, IsNull?  (Alan Gutierrez <alangutierrez@hotmail.com>)
Responses Re: Re: DateDiff, IsNull?  (Alan Gutierrez <alangutierrez@hotmail.com>)
List 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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Eh?
Next
From: "Josh Berkus"
Date:
Subject: Re: problem connecting to pg.