Skip site navigation (1) Skip section navigation (2)

Re: Integer input functions for date and timestamp

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Brendan Jurd <direvus(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Integer input functions for date and timestamp
Date: 2010-10-22 20:13:31
Message-ID: 1287778337-sup-3755@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Excerpts from Robert Haas's message of vie oct 22 16:54:01 -0300 2010:

> Ooh, I like it.  A related personal pet peeve of mine: AFAIK the
> easiest way to convert from an integer number of seconds to an
> interval representing that many seconds is:
> 
> (the_int || ' s')::interval
> 
> I guess we don't want to get too carried away with this, but has
> anyone else gotten annoyed by this?

Why do you go through text and concatenation?  I advocate this approach:
	the_int * interval '1 second'

I haven't measured it though.

-- 
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

pgsql-hackers by date

Next:From: Josh BerkusDate: 2010-10-22 20:26:44
Subject: Re: Extensions, this time with a patch
Previous:From: Alvaro HerreraDate: 2010-10-22 20:12:10
Subject: Re: Extensions, this time with a patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group