Forum OpenACS Q&A: postgres-pgtcl.sql --> Is it meant to be commented out in load-data-model.sql?

Just going through and looking for bugs in a copy of openACS which I
checked out of CVS a couple of days ago and had some problems with
the function months_between().  I found the declaration in postgres-
pgtcl.sql, checked my DB in postgres and found that the function
hadn't been created.  Checked the load-data-model.sql script which I
used to load the DB and found that the file had been commented out.
Is this meant to be the case??


It's supposed to be commented out as postgres-pgtcl.sql was a temporary work-around for pg 6.5.  I originally wrote it for porting the intranet module, but the need for a months_between function went away after an upgrade from aD.  Feel free to write one and submit it to cvs.  It looks like both ecommerce and glassroom make use of it.  I'm a little puzzled though, because I could swear that there either was a pl/sql version or that pg 7 had that function.  Oh well, I could be confusing it with something else.
Does anyone know the exact semantics of months_between in Oracle?

In other words, today's June 16th.

months_between(today, may 1) is one month.

Is months between(today, may 17th) one month or zero months? (i.e. does it truncate to the month then determine the interval?)

This routine's easy to implement in PL/pgSQL and I'll check one in if someone can tell me the exact semantics.

I've been playing around with Oracle, and it seems the answer to my question is ".98..."

I think I can emulate this well enough for the ACS, which only uses the integer portion.  I tried test cases for various lengthed months and the fractional part returned by Oracle is kinky (days left over/31?)

OK, I've checked in a version of postgres.sql that has a version of months_between that is correct in the integer part, at least.