RE: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of f rying pan, into fire)

From: Michael Davis <michael(dot)davis(at)prevuenet(dot)com>
To: hackers(at)postgreSQL(dot)org
Subject: RE: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of f rying pan, into fire)
Date: 1999-03-16 23:14:33
Message-ID: 93C04F1F5173D211A27900105AA8FCFC145294@lambic.prevuenet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

However it is implemented, I would really enjoy this enhancement.
Additionally, it would be nice if I could create a new operator using C and
have this new operator be associative if desired.

Speaking of this, If either LASTNAME or FIRSTNAME is NULL then the result of
((LASTNAME || ',' ) || FIRSTNAME) will return NULL. I would like to be able
to alter this such that the result will contain what ever is not NULL. I
tried to create a C function to overcome this but noticed that if any
parameter in my C function is NULL then the C function always returns NULL.
I saw some references in the archives about this issue but was unable to
determine where it was left. What is the status of this issue?

Thanks, Michael

-----Original Message-----
From: Bruce Momjian [SMTP:maillist(at)candle(dot)pha(dot)pa(dot)us]
Sent: Tuesday, March 16, 1999 3:24 PM
To: clark(dot)evans(at)manhattanproject(dot)com
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] 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(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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Clark Evans 1999-03-16 23:22:40 Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of frying pan, into fire)
Previous Message Bruce Momjian 1999-03-16 22:50:45 Subqueries and indexes