pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Glaesemann <grzm@myrealbox.com>
Cc: Achilleus Mantzios <achill@matrix.gatewaynet.com>
Cc: Pedro B. <pedro.borracha@netcabo.pt>
Cc: pgsql-sql@postgresql.org
Subject: Re: Datetime
Date: Tue, 03 Aug 2004 11:13:29 -0400
Message-ID: <23178.1091546009@sss.pgh.pa.us> (raw)
In-Reply-To: <B161AE30-E550-11D8-8966-000A95C88220@myrealbox.com>
References: <Pine.LNX.4.44.0408031449340.7249-100000@matrix.gatewaynet.com>
	<B161AE30-E550-11D8-8966-000A95C88220@myrealbox.com>

Michael Glaesemann <grzm@myrealbox.com> writes:
> No. I'm just saying that PostgreSQL does not represent or store 
> timestamps as epoch timestamps internally.

You're wrong.

It's not exactly Unix-like because we use a different epoch date
(2000-1-1 not 1970-1-1) but the concept is just the same: what's
stored is the number of seconds before or after the epoch.  The
default is to store this as a double precision number (hence supporting
fractional seconds, with a machine-dependent amount of precision)
but you can compile the server to use 64-bit integers instead.  In that
case the integer value actually represents microseconds before or after
the epoch, and so the precision is fixed at microseconds.

What you see when you display the value is an external textual
representation, not the internal form.  This is generally true for
all Postgres datatypes except text/varchar/char ...

			regards, tom lane



view thread (11+ messages)  latest in thread

Message-ID: <23178.1091546009@sss.pgh.pa.us>
Permalink:  ../23178.1091546009@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23178.1091546009@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, grzm@myrealbox.com, achill@matrix.gatewaynet.com, pedro.borracha@netcabo.pt
  Subject: Re: Datetime
  In-Reply-To: <23178.1091546009@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox