I still wonder if the for-update-tests in SelectStmt: are okay. Shouldn't
the test check for intersect_present=TRUE instead of intersectClause !=
NULL?

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!

Thu, 21 Jan 1999 16:06:32 +0100
Michael Meskes <Michael.Meskes@usa.net>
INTERSECT in gram.y again
> I still wonder if the for-update-tests in SelectStmt: are okay. Shouldn't
> the test check for intersect_present=TRUE instead of intersectClause !=
> NULL?

Looks like they are the same.  Both are true or false.

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

Thu, 21 Jan 1999 15:08:20 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] INTERSECT in gram.y again
On Thu, Jan 21, 1999 at 03:08:20PM -0500, Bruce Momjian wrote:
> > I still wonder if the for-update-tests in SelectStmt: are okay. Shouldn't
> > the test check for intersect_present=TRUE instead of intersectClause !=
> > NULL?
> 
> Looks like they are the same.  Both are true or false.

But I think intersectClause is set to op regardless if there is an intersect
clause at all. Or did I miss something?

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!

Fri, 22 Jan 1999 08:37:30 +0100
Michael Meskes <Michael.Meskes@usa.net>
Re: [HACKERS] INTERSECT in gram.y again
> On Thu, Jan 21, 1999 at 03:08:20PM -0500, Bruce Momjian wrote:
> > > I still wonder if the for-update-tests in SelectStmt: are okay. Shouldn't
> > > the test check for intersect_present=TRUE instead of intersectClause !=
> > > NULL?
> > 
> > Looks like they are the same.  Both are true or false.
> 
> But I think intersectClause is set to op regardless if there is an intersect
> clause at all. Or did I miss something?

As far as I can tell, The 'else' part of the query only gets executed in
the case of UNION, EXCEPT, or INTERCEPT.  Because FOR UPDATE is invalid
in all these cases, the intersectClause being non-NULL is an OK test,
though, as you point out, it is not accurate.  I have modified gram.y to
check just for unionClause:

if (n->unionClause != NULL)
 elog(ERROR, "SELECT FOR UPDATE is not allowed with UNION/INTERSECT/EXCEPT claus$

and removed the intersectClause test.  Thanks for pointing this out.

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

Fri, 22 Jan 1999 14:34:52 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] INTERSECT in gram.y again
On Fri, Jan 22, 1999 at 02:34:52PM -0500, Bruce Momjian wrote:
> As far as I can tell, The 'else' part of the query only gets executed in
> the case of UNION, EXCEPT, or INTERCEPT.  Because FOR UPDATE is invalid
> in all these cases, the intersectClause being non-NULL is an OK test,

You're right of course. 

> though, as you point out, it is not accurate.  I have modified gram.y to
> check just for unionClause:
> 
> if (n->unionClause != NULL)
>  elog(ERROR, "SELECT FOR UPDATE is not allowed with UNION/INTERSECT/EXCEPT claus$

But isn't the pure existance of for update enough to have an error in the
else branch?

And can't we get the same error in the if branch as well with a having
clause or something like that?

Michael

-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!

Sat, 23 Jan 1999 13:27:36 +0100
Michael Meskes <Michael.Meskes@usa.net>
Re: [HACKERS] INTERSECT in gram.y again
> But isn't the pure existance of for update enough to have an error in the
> else branch?
> 
> And can't we get the same error in the if branch as well with a having
> clause or something like that?

But we have those tests at the end, after the if/else, don't we?

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

Sat, 23 Jan 1999 16:31:59 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] INTERSECT in gram.y again
On Sat, Jan 23, 1999 at 04:31:59PM -0500, Bruce Momjian wrote:
> But we have those tests at the end, after the if/else, don't we?

You're right again of course. Sorry for misreading this.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!

Sun, 24 Jan 1999 10:02:21 +0100
Michael Meskes <Michael.Meskes@usa.net>
Re: [HACKERS] INTERSECT in gram.y again