From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Joe Conway <mail(at)joeconway(dot)com> |
Cc: | Martijn van Oosterhout <kleptog(at)svana(dot)org>, Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: how solve diff of API counstruct_md_array between |
Date: | 2006-02-24 19:57:19 |
Message-ID: | 200602241957.k1OJvJj06015@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Joe Conway wrote:
> Martijn van Oosterhout wrote:
> > On Thu, Feb 16, 2006 at 08:36:34PM +0100, Pavel Stehule wrote:
> >>I use counstruct_md_array function in my Orafunc module. CVS version has
> >>diff def now. I am findig way for simple solution of maintaince source code
> >>for both version. I have PG_VERSION variable, but it's unusable. Is there
> >>way for contrib's autors differentiate PostgreSQL versions? I don't want to
> >>have two versions of source code.
> >
> > For my stuff I've generally use CATALOG_VERSION_NO. It's not very easy,
> > but by looking through CVS you can find when the function was created
> > and in your code use:
> >
> > #ifdef CATALOG_VERSION_NO > yyyymmddN
> > /* New stuff */
> > #else
> > /* Old stuff */
> > #endif
>
> I do pretty much the same thing in PL/R. The good news is that
> CATALOG_VERSION_NO doesn't change for each major release once it is
> released. The following hasn't been updated since the 8.1 release, but
> you could use it as a starting point:
>
> #if (CATALOG_VERSION_NO <= 200211021)
> #define PG_VERSION_73_COMPAT
> #elif (CATALOG_VERSION_NO <= 200310211)
> #define PG_VERSION_74_COMPAT
> #elif (CATALOG_VERSION_NO <= 200411041)
> #define PG_VERSION_80_COMPAT
> #else
> #define PG_VERSION_81_COMPAT
> #endif
Yea, that is probably the best you can do currently, but it is pretty
ugly. We have PQserverVersion() in libpq for use by clients, which
does:
conn->sversion = (100 * vmaj + vmin) * 100 + vrev;
Perhaps we should have a function in the server that has this.
PG_VERSION isn't easy to use because it is a string, and changes during
minor versions.
initdb.c uses get_short_version() to trims PG_VERSION to the major part.
--
Bruce Momjian http://candle.pha.pa.us
SRA OSS, Inc. http://www.sraoss.com
+ If your life is a hard drive, Christ can be your backup. +
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2006-02-24 20:14:07 | Re: how solve diff of API counstruct_md_array between |
Previous Message | Hannu Krosing | 2006-02-24 19:16:57 | Re: fsutil ideas |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-02-24 20:00:54 | Re: memset using long instead of int32 |
Previous Message | Bruce Momjian | 2006-02-24 17:18:22 | Re: [HACKERS] Patch Submission Guidelines |