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-17 00:02:06
Message-ID: 93C04F1F5173D211A27900105AA8FCFC145296@lambic.prevuenet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I am not suggesting that all functions or operators work this way, because I
believe the current implementation is more standard. I would like to be
able to over ride this default behavior and change a NULL value into return
value. A great example of this is the Access function nz(int_value). If
int_value is null, nz() returns 0, it is it not null then int_value is
returned. I used this function frequently in Access and would like to take
advantage of this in PostgreSQL.

Thanks, Michael

-----Original Message-----
From: Clark Evans [SMTP:clark(dot)evans(at)manhattanproject(dot)com]
Sent: Tuesday, March 16, 1999 4:23 PM
To: Michael Davis
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Associative Operators? (Was: Re:
[NOVICE] Out of frying pan, into fire)

Michael Davis wrote:
> 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?

Although I feel initial opposition to this idea, on second
consideration, I guess it is reasonable behavior, in Oracle,
the NVL function and the DECODE function both handle NULL
arguments without having the result be NULL.

However, I'm unaware of any other exceptions in the Oracle
database on this issue. I believe that user defined functions
are not allowed to have special NULL treatment -- perhaps
Oracle has DECODE and NVL hard coded deep in the guts of
their query processor, while the other functions arn't.

Would a compromise be to add DECODE and NVL ?

Clark

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Davis 1999-03-17 00:02:50 RE: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of f rying pan, into fire)
Previous Message Ross J. Reedstrom 1999-03-16 23:58:33 Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of frying pan, into fire)