pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Udick <John.Udick@zionsbancorp.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin.Grittner@wicourts.gov <Kevin.Grittner@wicourts.gov>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #6391: insert does not insert correct value
Date: Wed, 11 Jan 2012 09:16:51 -0700
Message-ID: <BEC72D0140FBF24EB055A6D15F47FADC105A210CF0@UTEXVS02.zbc.internal> (raw)
In-Reply-To: <19647.1326295274@sss.pgh.pa.us>
References: <E1RkkYs-0004gn-TS@wrigleys.postgresql.org>
	<19647.1326295274@sss.pgh.pa.us>

Following the example provided, this still appears to be a bug. The results are very different when we run the example. We did notice that although now() failed, changing this to 'now()'::date works (using single quotes around now()). I will be working with our administrators to review patches and version levels. 

Also, apparently we are not truly a Postgres database, but EMC's Greenplum database. I will be working with our admins and EMC, unless someone in Postgres can point out a specific version that resolved this issue. 

drop table if exists t;
create table t 
  (id int primary key, 
   d1 date not null, 
   d2 date not null);
   
insert into t
  values
    (1, now(), current_date),
    (2, localtimestamp::date, date_in(date_out(current_date))),
    (3, 'now()'::date, clock_timestamp()::DATE);

select * from t order by 1;

 id |     d1     |     d2     
----+------------+------------
  1 | 1999-12-31 | 1999-12-31
  2 | 1999-12-31 | 1999-12-31
  3 | 2012-01-11 | 2012-01-11

Additional information - select version();
"PostgreSQL 8.2.15 (Greenplum Database 4.1.1.5 build 1) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Sep 20 2011 11:09:08"

John Udick | Enterprise Data Warehouse Development

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us] 
Sent: Wednesday, January 11, 2012 8:21 AM
To: John Udick
Cc: pgsql-bugs@postgresql.org
Subject: Re: [BUGS] BUG #6391: insert does not insert correct value 

john.udick@zionsbancorp.com writes:
> I would expect that at the time/date of the of now() and clock_timestamp()
> to be equal; which they are.

Well, they are not in general, but that doesn't appear to be your
problem.  You have not shown us a reproducible test case, but I wonder
whether your table has a trigger that is doing date_trunc('year',...)
or something like that on the column value.

			regards, tom lane

======================================================================
THIS ELECTRONIC MESSAGE, INCLUDING ANY ACCOMPANYING DOCUMENTS, IS CONFIDENTIAL and may contain information that is privileged and exempt from disclosure under applicable law. If you are neither the intended recipient nor responsible for delivering the message to the intended recipient, please note that any dissemination, distribution, copying or the taking of any action in reliance upon the message is strictly prohibited. If you have received this communication in error, please notify the sender immediately.  Thank you.



view thread (6+ messages)  latest in thread

Message-ID: <BEC72D0140FBF24EB055A6D15F47FADC105A210CF0@UTEXVS02.zbc.internal>
Permalink:  ../BEC72D0140FBF24EB055A6D15F47FADC105A210CF0@UTEXVS02.zbc.internal/
Also on:    postgresql.org/message-id/BEC72D0140FBF24EB055A6D15F47FADC105A210CF0@UTEXVS02.zbc.internal

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: John.Udick@zionsbancorp.com, tgl@sss.pgh.pa.us, Kevin.Grittner@wicourts.gov
  Subject: Re: BUG #6391: insert does not insert correct value
  In-Reply-To: <BEC72D0140FBF24EB055A6D15F47FADC105A210CF0@UTEXVS02.zbc.internal>
  References: <E1RkkYs-0004gn-TS@wrigleys.postgresql.org> <19647.1326295274@sss.pgh.pa.us> <BEC72D0140FBF24EB055A6D15F47FADC105A210CF0@UTEXVS02.zbc.internal>

* 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