add, subtract bool type - Mailing list pgsql-general

From Jeff Davis
Subject add, subtract bool type
Date
Msg-id 3B8353A3.40705@dynworks.com
Whole thread Raw
Responses Re: add, subtract bool type  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: add, subtract bool type  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-general
I made some simple functions that create the operators + and - for any
combination of int4's and bool's.

The reasoning that propted this operator was that I wanted to use the
following syntax in a query:
SELECT *,((col_a == 'foo') + (col_b == 'bar')) as relevance WHERE
relevance > 0;

The idea is that the attribute 'relevance' counts the number of matching
criteria. Such functionality would be most useful in a search engine,
but may have other uses.

My question is two-part:
1) Is this a sane approach?
2) Might enough other people find a use that I should make a
contribution somewhere (and would it be appropriate to send it to
pgsql-hackers or pgsql-patches)? Is there a chance it will get
incorporated into the main  source?

Regards,
Jeff Davis


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Sort by foreign date column
Next
From: jose
Date:
Subject: maximum query length