Seth McQuale pointed out that the follwing does not work:
  SELECT LASTNAME || ',' || FIRSTNAME [AS] NAME FROM FRIENDS;

The solution, was:
  SELECT ( LASTNAME || ',' ) || FIRSTNAME AS NAME FROM FRIENDS;

I looked at pg_operator and didn't see any flag to mark
an operator as 'associative'.   Perhaps if we added a flag
like this, the re-write system could be modified to handle
cases like this.

Thoughts?

Clark Evans

Tue, 16 Mar 1999 21:29:55 +0000
Clark Evans <clark.evans@manhattanproject.com>
Associative Operators?  (Was: Re: [NOVICE] Out of frying pan,
	into fire)
> Seth McQuale pointed out that the follwing does not work:
>   SELECT LASTNAME || ',' || FIRSTNAME [AS] NAME FROM FRIENDS;
> 
> The solution, was:
>   SELECT ( LASTNAME || ',' ) || FIRSTNAME AS NAME FROM FRIENDS;
> 
> I looked at pg_operator and didn't see any flag to mark
> an operator as 'associative'.   Perhaps if we added a flag
> like this, the re-write system could be modified to handle
> cases like this.
> 
> Thoughts?
> 
> Clark Evans
> 
> 

My guess is that we should auto-left-associate functions like || if no
parens are present.  It would be a small change to the parser.

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

Tue, 16 Mar 1999 17:23:52 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of frying
	pan, into fire)
Bruce Momjian wrote:
> 
> My guess is that we should auto-left-associate functions like || if no
> parens are present.  It would be a small change to the parser.

I was trying to describe a more general solution,
where the operator is marked if it is associative
when it is created.  This would allow the same
mechanism to be used for user defined types.

:) Clark

Tue, 16 Mar 1999 22:34:57 +0000
Clark Evans <clark.evans@manhattanproject.com>
Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of frying
	pan, into fire)
Thus spake Bruce Momjian
> > I looked at pg_operator and didn't see any flag to mark
> > an operator as 'associative'.   Perhaps if we added a flag
> > like this, the re-write system could be modified to handle
> > cases like this.
> 
> My guess is that we should auto-left-associate functions like || if no
> parens are present.  It would be a small change to the parser.

And wouldn't require a dump/reload.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.

Tue, 16 Mar 1999 17:36:58 -0500 (EST)
"D'Arcy" "J.M." Cain <darcy@druid.net>
Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of frying
	pan, into fire)
"D'Arcy J.M. Cain" wrote:
> And wouldn't require a dump/reload.

Why would this require a dump/reload?  It would seem
to  me that this would only be needed if you changed
the database storage system?   Am I missing something?

Clark

Tue, 16 Mar 1999 22:42:04 +0000
Clark Evans <clark.evans@manhattanproject.com>
Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of frying
	pan, into fire)
"D'Arcy J.M. Cain" wrote:
> And wouldn't require a dump/reload.

Ooh.  If you change pg_operators and add a column. Ok.
For the new version, don't they have to do this anyway?

Clark

Tue, 16 Mar 1999 22:45:22 +0000
Clark Evans <clark.evans@manhattanproject.com>
Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of frying
	pan, into fire)

This is fixed in 6.5 beta.


> Seth McQuale pointed out that the follwing does not work:
>   SELECT LASTNAME || ',' || FIRSTNAME [AS] NAME FROM FRIENDS;
> 
> The solution, was:
>   SELECT ( LASTNAME || ',' ) || FIRSTNAME AS NAME FROM FRIENDS;
> 
> I looked at pg_operator and didn't see any flag to mark
> an operator as 'associative'.   Perhaps if we added a flag
> like this, the re-write system could be modified to handle
> cases like this.
> 
> Thoughts?
> 
> Clark Evans
> 
> 


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

Sun, 9 May 1999 20:51:25 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of frying
	pan, into fire)