Use of multiple || and precidence

Started by Bruce Momjianalmost 27 years ago2 messages
#1Bruce Momjian
maillist@candle.pha.pa.us

I have made a change so that all operators except "+-*/%" are now
left-associative, rather than being non-associative:

select 'a' || 'b' || 'c';

The old code does:

test=> select 'a' || 'b' || 'c';
ERROR: parser: parse error at or near "||"

Is this a problem for people? It will now not complain about missing
parens, but left-associate all these operations. Any problems with
that?

The code still associates "+-*/%" so that "*/%" is done first, then
"+-".

-- 
  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
#2Michael Davis
michael.davis@prevuenet.com
In reply to: Bruce Momjian (#1)
RE: [HACKERS] Use of multiple || and precidence

Yes!!!!

-----Original Message-----
From: Bruce Momjian [SMTP:maillist@candle.pha.pa.us]
Sent: Wednesday, March 17, 1999 1:58 PM
To: hackers@postgreSQL.org
Subject: [HACKERS] Use of multiple || and precidence

I have made a change so that all operators except "+-*/%" are now
left-associative, rather than being non-associative:

select 'a' || 'b' || 'c';

The old code does:

test=> select 'a' || 'b' || 'c';
ERROR: parser: parse error at or near "||"

Is this a problem for people? It will now not complain about
missing
parens, but left-associate all these operations. Any problems with
that?

The code still associates "+-*/%" so that "*/%" is done first, then
"+-".

	-- 
	  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