Re: Problems with using function input paramaters

2019-08-31 Thread Tom Lane
"David G. Johnston" writes: > On Sat, Aug 31, 2019 at 7:05 AM stan wrote: >> CURRENT_DATE) - interval ' $1 >> month - 1 >> ' day as date) > ($1 || ' month')::interval -- should work FWIW, I tend to prefer doing it with interval arithmetic, like this: $1 * '1 month'::interval - '1 day'::inter

Re: Problems with using function input paramaters

2019-08-31 Thread David G. Johnston
On Sat, Aug 31, 2019 at 7:05 AM stan wrote: > > CURRENT_DATE) - interval ' $1 > month - 1 > ' day as date) > ($1 || ' month')::interval -- should work Content within a literal (i.e., between single quotes) is always treated as li

Re: Problems with using function input paramaters

2019-08-31 Thread stan
On Sat, Aug 31, 2019 at 10:05:10AM -0400, stan wrote: > I have been chasing a bug for a bit now. I even wound up completely rewriting > the > function, which in the end turns out to be a good thing, as it is much > cleaner and > easy to read. > > I now believe that the bug is in how I am using

Problems with using function input paramaters

2019-08-31 Thread stan
I have been chasing a bug for a bit now. I even wound up completely rewriting the function, which in the end turns out to be a good thing, as it is much cleaner and easy to read. I now believe that the bug is in how I am using an input parameter to the function. Here is the function deceleratio