Re: string || NULL ambiguity - Mailing list pgsql-hackers

From Thomas T. Thai
Subject Re: string || NULL ambiguity
Date
Msg-id 2060.63.226.186.156.1048128984.squirrel@mail.minnesota.com
Whole thread Raw
In response to Re: string || NULL ambiguity  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-hackers
> On Wed, 19 Mar 2003, Alvaro Herrera wrote:
>
>> On Wed, Mar 19, 2003 at 10:26:05PM +0300, Oleg Bartunov wrote:
>>
>> > we have a little problem in new version of tsearch we're currently
>> working. We've implemented concatenation operation for txtidx type
>> and treat concatenation with NULL as NULL (as it should be).
>> > But people get confused with such behaivour. Do we obliged to
>> > follow NULL rule ? It seems more natural in case of text searching
>> to treat stringA||NULL as stringA.
>>
>> Why don't you just enclose the possibly NULL fields in COALESCE?
>>
>> stringA||COALESCE(NULL, '')
>>
>
> we don't know in advance if it's NULL or not.

I'm the user who reported this on the OpenFTS list. May I suggest allowing
'' in txtidx column type as we do with datatype text, char, and varchar.
That way concat will work as expected for text searching.

--
Thomnas




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Open 7.4 features
Next
From: Bruce Momjian
Date:
Subject: Re: cursors outside transactions