add, subtract bool type

From: Jeff Davis <list-pgsql-general(at)dynworks(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: add, subtract bool type
Date: 2001-08-22 06:39:31
Message-ID: 3B8353A3.40705@dynworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message jose 2001-08-22 07:51:58 maximum query length
Previous Message Tom Lane 2001-08-22 04:47:44 Re: Sort by foreign date column