Re: timestamps, formatting, and internals

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: timestamps, formatting, and internals
Date: 2012-05-27 06:25:19
Message-ID: jpshcf$rsb$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2012-05-18, David Salisbury <salisbury(at)globe(dot)gov> wrote:

> So one question I have is if there a way to set PG in the way Oracle does it..

probably not.

> set nls_date_format = 'YYYY...' so I can query and see exactly what PG is seeing,
> even to the microseconds?

set datestyle to 'ISO';

> Is there a config parameter I can set in PG so that calculations
> are done only to the second?

no, but you can truncate explicitly
date_trunc('second',your_timestamp_expression)

The query: "show integer_datetimes;" should return 'on' which means
timestamps are microsecond precision if it returns 'off' your database
was built with floating point timstamps and equality tests will be
unreliable,

> It seems this join doesn't always find a record that's closest
> to solar noon, and therefore drops the summary and join record all together.

you didn't show the actual join only the where clause.

given your task I would create CTEs finding the first record before
and after local solar noon, then combine them with a union and feed
the result of that to another disctint on to filter the most
appropriate record for each site.

--
⚂⚃ 100% natural

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message F. BROUARD / SQLpro 2012-05-27 08:46:21 Re: PG vs MSSQL language comparison ?
Previous Message Brian Palmer 2012-05-27 02:13:11 Re: Not understanding this behavior of a subselect + volatile function