patch for BETWEEN [ASYMMETRIC|SYMMETRIC]

Lists: pgsql-patches
From: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-01-11 02:01:57
Message-ID: 01011020580502.15894@comptechnews
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

This was a trivial thing to implement in the parser (unless I overlooked
something!). Please review it and let me know if I missed something. This
adds SQL-1999 BETWEEN [ASYMMETRIC|SYMMETRIC] language. Hopefully it's not
considered just SQL bloat. ;)

--
-------- Robert B. Easter reaster(at)comptechnews(dot)com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------

Attachment Content-Type Size
gram.y.patch text/x-c 2.0 KB
keywords.c.patch text/plain 489 bytes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-01-11 03:29:22
Message-ID: 10272.979183762@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

"Robert B. Easter" <reaster(at)comptechnews(dot)com> writes:
> This was a trivial thing to implement in the parser (unless I overlooked
> something!). Please review it and let me know if I missed something.

ColId (or at least ColLabel) entries for the added keywords.

This doesn't strike me as a particularly efficient implementation,
but until there's a groundswell of actual use, maybe we don't care...

regards, tom lane


From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-01-11 03:32:54
Message-ID: 3A5D2966.A5714DCE@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

> This was a trivial thing to implement in the parser (unless I overlooked
> something!). Please review it and let me know if I missed something. This
> adds SQL-1999 BETWEEN [ASYMMETRIC|SYMMETRIC] language. Hopefully it's not
> considered just SQL bloat. ;)

No more bloat than in the rest of the language ;)

I *assume* that this will have trouble making it in to 7.1, and since
keywords are likely added this may have trouble with 7.1.x (not sure
about that; perhaps the lex-generated token values never make it into
the database tables, but they *do* propagate into structures used deeper
in the backend).

- Thomas


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: lockhart(at)fourpalms(dot)org
Cc: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-01-11 03:45:03
Message-ID: 10337.979184703@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
> I *assume* that this will have trouble making it in to 7.1, and since
> keywords are likely added this may have trouble with 7.1.x (not sure
> about that; perhaps the lex-generated token values never make it into
> the database tables, but they *do* propagate into structures used deeper
> in the backend).

Since he didn't add a new parsetree node type, there wouldn't be any
database compatibility issue AFAIK. I'm pretty certain that keyword
token values never get into stored rules.

However, there is our self-imposed "no new features during beta" rule.
This looks like a relatively harmless patch, but do we want to break
that rule for something that people are not beating down our doors for?

I'd vote for holding it for 7.2, I think.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: lockhart(at)fourpalms(dot)org, "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-01-12 04:48:40
Message-ID: 200101120448.XAA26972@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


I concur. about holding for 7.2. Though this is of limited danger, it
is not something that is really in hight demand.

> Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
> > I *assume* that this will have trouble making it in to 7.1, and since
> > keywords are likely added this may have trouble with 7.1.x (not sure
> > about that; perhaps the lex-generated token values never make it into
> > the database tables, but they *do* propagate into structures used deeper
> > in the backend).
>
> Since he didn't add a new parsetree node type, there wouldn't be any
> database compatibility issue AFAIK. I'm pretty certain that keyword
> token values never get into stored rules.
>
> However, there is our self-imposed "no new features during beta" rule.
> This looks like a relatively harmless patch, but do we want to break
> that rule for something that people are not beating down our doors for?
>
> I'd vote for holding it for 7.2, I think.
>
> regards, tom lane
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-01-24 03:26:22
Message-ID: 200101240326.WAA25301@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Can someone comment on this?

[ Charset ISO-8859-1 unsupported, converting... ]
> This was a trivial thing to implement in the parser (unless I overlooked
> something!). Please review it and let me know if I missed something. This
> adds SQL-1999 BETWEEN [ASYMMETRIC|SYMMETRIC] language. Hopefully it's not
> considered just SQL bloat. ;)
>
> --
> -------- Robert B. Easter reaster(at)comptechnews(dot)com ---------
> -- CompTechNews Message Board http://www.comptechnews.com/ --
> -- CompTechServ Tech Services http://www.comptechserv.com/ --
> ---------- http://www.comptechnews.com/~reaster/ ------------
>
>

[ Attachment, skipping... ]

[ Attachment, skipping... ]

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-01-24 04:55:07
Message-ID: 10695.980312107@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Can someone comment on this?

It's a new feature, so it should wait for 7.2 ...

In any case, there are further considerations here, like getting
ruleutils.c to reverse-list the construct correctly. When we
redesign querytree structures, reconstructability needs to be one
of the considerations.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-03-21 04:34:48
Message-ID: 200103210434.XAA20136@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Robert, did we ever resolve if this is a valuable patch?

[ Charset ISO-8859-1 unsupported, converting... ]
> This was a trivial thing to implement in the parser (unless I overlooked
> something!). Please review it and let me know if I missed something. This
> adds SQL-1999 BETWEEN [ASYMMETRIC|SYMMETRIC] language. Hopefully it's not
> considered just SQL bloat. ;)
>
> --
> -------- Robert B. Easter reaster(at)comptechnews(dot)com ---------
> -- CompTechNews Message Board http://www.comptechnews.com/ --
> -- CompTechServ Tech Services http://www.comptechserv.com/ --
> ---------- http://www.comptechnews.com/~reaster/ ------------
>
>

[ Attachment, skipping... ]

[ Attachment, skipping... ]

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-05-07 18:47:26
Message-ID: 200105071847.f47IlQH20283@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Can someone comment on where we left this?

> This was a trivial thing to implement in the parser (unless I overlooked
> something!). Please review it and let me know if I missed something. This
> adds SQL-1999 BETWEEN [ASYMMETRIC|SYMMETRIC] language. Hopefully it's not
> considered just SQL bloat. ;)

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

*** gram.y Wed Jan 10 20:45:40 2001
--- gram.y.modi Wed Jan 10 20:44:38 2001
***************
*** 321,332 ****
WHEN, WHERE, WITH, WORK, YEAR_P, ZONE

/* Keywords (in SQL3 reserved words) */
! %token CHAIN, CHARACTERISTICS,
DEFERRABLE, DEFERRED,
IMMEDIATE, INITIALLY, INOUT,
OFF, OUT,
PATH_P, PENDANT,
RESTRICT,
TRIGGER,
WITHOUT

--- 321,334 ----
WHEN, WHERE, WITH, WORK, YEAR_P, ZONE

/* Keywords (in SQL3 reserved words) */
! %token ASYMMETRIC,
! CHAIN, CHARACTERISTICS,
DEFERRABLE, DEFERRED,
IMMEDIATE, INITIALLY, INOUT,
OFF, OUT,
PATH_P, PENDANT,
RESTRICT,
+ SYMMETRIC,
TRIGGER,
WITHOUT

***************
*** 4452,4462 ****
--- 4454,4496 ----
makeA_Expr(OP, ">=", $1, $3),
makeA_Expr(OP, "<=", $1, $5));
}
+ | a_expr BETWEEN ASYMMETRIC b_expr AND b_expr
+ {
+ $$ = makeA_Expr(AND, NULL,
+ makeA_Expr(OP, ">=", $1, $4),
+ makeA_Expr(OP, "<=", $1, $6));
+ }
+ | a_expr BETWEEN SYMMETRIC b_expr AND b_expr
+ {
+ $$ = makeA_Expr(OR, NULL,
+ makeA_Expr(AND, NULL,
+ makeA_Expr(OP, ">=", $1, $4),
+ makeA_Expr(OP, "<=", $1, $6)),
+ makeA_Expr(AND, NULL,
+ makeA_Expr(OP, ">=", $1, $6),
+ makeA_Expr(OP, "<=", $1, $4)) );
+ }
| a_expr NOT BETWEEN b_expr AND b_expr
{
$$ = makeA_Expr(OR, NULL,
makeA_Expr(OP, "<", $1, $4),
makeA_Expr(OP, ">", $1, $6));
+ }
+ | a_expr NOT BETWEEN ASYMMETRIC b_expr AND b_expr
+ {
+ $$ = makeA_Expr(OR, NULL,
+ makeA_Expr(OP, "<", $1, $5),
+ makeA_Expr(OP, ">", $1, $7));
+ }
+ | a_expr NOT BETWEEN SYMMETRIC b_expr AND b_expr
+ {
+ $$ = makeA_Expr(AND, NULL,
+ makeA_Expr(OR, NULL,
+ makeA_Expr(OP, "<", $1, $5),
+ makeA_Expr(OP, ">", $1, $7)),
+ makeA_Expr(OR, NULL,
+ makeA_Expr(OP, "<", $1, $7),
+ makeA_Expr(OP, ">", $1, $5)) );
}
| a_expr IN '(' in_expr ')'
{

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-05-07 21:31:17
Message-ID: 23211.989271077@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Can someone comment on where we left this?

The grammar patch is incorrect/incomplete as given (no keywords.c
entries, no additions to the TokenId list), unless you quoted only
part of it.

More generally, I hate to see us yet again doing a quick shortcut that
loses information. BETWEEN really ought to be a 3-operand function or
special expression node type, so that it (a) can be reverse-listed
sensibly, and (b) doesn't result in multiple evaluations of its inputs.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC]
Date: 2001-05-07 22:11:09
Message-ID: 200105072211.f47MB9W04148@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


OK, patch rejected.

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Can someone comment on where we left this?
>
> The grammar patch is incorrect/incomplete as given (no keywords.c
> entries, no additions to the TokenId list), unless you quoted only
> part of it.
>
> More generally, I hate to see us yet again doing a quick shortcut that
> loses information. BETWEEN really ought to be a 3-operand function or
> special expression node type, so that it (a) can be reverse-listed
> sensibly, and (b) doesn't result in multiple evaluations of its inputs.
>
> regards, tom lane
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026