BETWEEN SYMMETRIC/ASYMMETRIC patch

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: BETWEEN SYMMETRIC/ASYMMETRIC patch
Date: 2002-04-10 07:09:18
Message-ID: GNELIHDDFBOCMGBFGEFOKEBBCCAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi,

This patch implements the TODO item:

* Add BETWEEN ASYMMETRIC/SYMMETRIC

I have added a regression test to select.sql - I don't know if this is the
correct place. Someone should run their eyes over the results in select.out
to make sure they are correct. There are some "non intuitive" results...

This patch makes ASYMMETRIC and SYMMETRIC reserved words and this should be
mentioned in the release notes.

I used the not(a and b) = not(a) or not(b) expansion to derive the
expressions.

Chris

This is what the SQL99 spec has to say on the matter, I believe this patch
adheres to the spec:

----------------------------

<between predicate> ::=
<row value expression> [ NOT ] BETWEEN
[ ASYMMETRIC | SYMMETRIC ]
<row value expression> AND <row value expression>

Syntax Rules

1) If neither SYMMETRIC nor ASYMMETRIC is specified, then
ASYMMETRIC is implicit.

2) Let X, Y, and Z be the first, second, and third <row value
expression>s, respectively.

3) "X NOT BETWEEN SYMMETRIC Y AND Z" is equivalent to "NOT ( X
BETWEEN SYMMETRIC Y AND Z )".

4) "X BETWEEN SYMMETRIC Y AND Z" is equivalent to "((X BETWEEN
ASYMMETRIC Y AND Z) OR (X BETWEEN ASYMMETRIC Z AND Y))".

5) "X NOT BETWEEN ASYMMETRIC Y AND Z" is equivalent to "NOT ( X
BETWEEN ASYMMETRIC Y AND Z )".

6) "X BETWEEN ASYMMETRIC Y AND Z" is equivalent to "X>=Y AND X<=Z".

Access Rules

None.

General Rules

None.

Conformance Rules

1) Without Feature T461, "Symmetric <between predicate>",
conforming SQL language shall not specify SYMMETRIC or
ASYMMETRIC.

2) Without Feature S024, "Enhanced structured types", no subfield
of the declared type of a <row value expression> that is simply
contained in a <between predicate> shall be of a structured
type.

Attachment Content-Type Size
between.txt.gz application/x-gzip 1.4 KB

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-04-11 05:35:39 Re: FW: [HACKERS] decode() function for PostgreSQL
Previous Message Tom Lane 2002-04-09 19:46:33 Re: unknownin/out patch (was [HACKERS] PQescapeBytea is