public inbox for [email protected]  
help / color / mirror / Atom feed
From: Luiz E. P. Fernandes <[email protected]>
To: [email protected]
Subject: Seconds precision in timestamp columns
Date: Fri, 16 Jul 2021 16:03:53 -0300
Message-ID: <[email protected]> (raw)

Hi,

In the dvdrental example database, there is a column named 
'payment_date' on the 'payment' table and columns 'rental_date' and 
'return_date' on the 'rental' table.  These columns appear on the 
information_schema.columns view with identical specifications: datatype 
= 'timestamp without timezone', datetime_precision = 6. However, a 
select on table 'payment' presents column 'payment_date' with 6 
fractional digits, while a select on table 'rental' presents columns 
'rental_date' and 'return_date' without fractional digits.

select payment_date from payment limit 1;
--> for example, payment_date: '2007-02-15 22:25:46.996577'

select rental_date, return_date from rental limit 1;
--> for example, rental_date: '2005-05-24 22:54:33'

This happens in PgAdmin and also in the query values returned by 
PQgetvalue(), with LibPq.
What defines this seconds precision?  Is it possible to find the number 
of fractional digits that will be returned in a datetime column, before 
calling PQgetvalue()?

Thanks in advance.

Luiz Fernandes







view thread (2+ messages)  latest in thread

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: [email protected]
  Cc: [email protected]
  Subject: Re: Seconds precision in timestamp columns
  In-Reply-To: <[email protected]>

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

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