On Fri, 2014-08-01 at 22:28 -0700, Mike Swanson wrote:
> I'd also argue that the current function basing the logic from
> definition #2 has limited use even when you want to use it for such.
> If you want to generate text for '(decades)s' you'd have to do:
>   SELECT extract('year' from date_trunc('decade', now())) || 's';
> Or with my patch:
>   SELECT floor(extract('year' from now()) / 10) || '0s';
> It's different, for sure, but I would actually think the second one is
> a bit less awkward.  Plus it's shorter :)

I'm responding to myself because I realized that what I wrote was a bit
silly.  The first and current example (which is invalidated by my patch)
should really be:
  SELECT extract('decade' from now()) || '0s';
which makes it the shorter and simpler version of the two.  I'll still
stand by my opinion that it's not an extremely useful function as it is.



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to