Re: Script errors on run

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Ralph Smith <smithrn(at)washington(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Script errors on run
Date: 2008-06-04 22:30:43
Message-ID: 20080604152637.Q81896@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 4 Jun 2008, Ralph Smith wrote:

> date_string := to_date(year||'-'||month||'-'||day , 'YYYY-MM-DD') ;
> RAISE INFO 'date_string = %', date_string ;
> good_date := to_timestamp(date_string, 'YYYY-MM-DD') ;
> RAISE INFO 'good_date = %', good_date ;

This seems like alot of extra work, due to the implicit cast from date to
timestamp. I think
good_date := to_date(year || '-' || month || '-' || day, 'YYYY-MM-DD')
might work and just be simpler.

> UsecsD := EXTRACT(EPOCH FROM TIMESTAMP 'good_date') ;

If good_date's already a timestamp, I think this should just be:
EXTRACT(EPOCH FROM good_date)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-06-04 22:45:12 Re: functions, transactions, key violations
Previous Message Michael Glaesemann 2008-06-04 22:21:28 Re: functions, transactions, key violations