Thread: FW: [HACKERS] decode() function for PostgreSQL

FW: [HACKERS] decode() function for PostgreSQL

From
"Archana Bharatee"
Date:
Dear Bruce,

I am not familiar with the process of applying patches. I am attaching the
source-code for the decode function we have developed for PostgreSQL. Can
you please do the needful, or redirect me to the appropriate person.

Thanks a lot,

warm regards,
Archana Bharatee

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: Monday, February 25, 2002 10:33 PM
To: Archana Bharatee
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] decode()


Archana Bharatee wrote:
> We have developed a 'C' function to provide Oracle decode() functionality.
> we have developed a C function DECODE which accepts an SQL Query and
> replaces occurence of decode with case-when-then-else-end and returns the
> query. There is no limitation of fixed number of parameters.  This needs
to
> be added to PostgreSQL library. How do we do this?

Send the patch to the patches list.  A context diff against against 7.2
or CVS is just fine.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@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

Attachment

Re: FW: [HACKERS] decode() function for PostgreSQL

From
Peter Eisentraut
Date:
Archana Bharatee writes:

> I am not familiar with the process of applying patches. I am attaching the
> source-code for the decode function we have developed for PostgreSQL. Can
> you please do the needful, or redirect me to the appropriate person.

Could you describe what your function does?  Not all of us are familiar
with Oracle.

--
Peter Eisentraut   peter_e@gmx.net


Re: FW: [HACKERS] decode() function for PostgreSQL

From
Bruce Momjian
Date:
I have reviewed this patch.  It actually outputs just a new query string
that replaces the DECODE with CASE, as you mentioned.  I don't think
this has use in our existing code.  It would be more appropriate if
somehow it converted the string in the gram.y file from DECODE to
CASE.

However, with CASE available and standard SQL, I am not even sure if we
would want to support DECODE, except for conversion usage.  Was that the
purpose of the function you sent in?

Do other Oracle users see a need for something that understands DECODE?

---------------------------------------------------------------------------

Archana Bharatee wrote:
> Dear Bruce,
>
> I am not familiar with the process of applying patches. I am attaching the
> source-code for the decode function we have developed for PostgreSQL. Can
> you please do the needful, or redirect me to the appropriate person.
>
> Thanks a lot,
>
> warm regards,
> Archana Bharatee
>
> -----Original Message-----
> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> Sent: Monday, February 25, 2002 10:33 PM
> To: Archana Bharatee
> Cc: pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] decode()
>
>
> Archana Bharatee wrote:
> > We have developed a 'C' function to provide Oracle decode() functionality.
> > we have developed a C function DECODE which accepts an SQL Query and
> > replaces occurence of decode with case-when-then-else-end and returns the
> > query. There is no limitation of fixed number of parameters.  This needs
> to
> > be added to PostgreSQL library. How do we do this?
>
> Send the patch to the patches list.  A context diff against against 7.2
> or CVS is just fine.
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@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

[ Attachment, skipping... ]

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@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