pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Leslie Mikesell <les@Mcs.Net>
To: pgsql-sql@postgreSQL.org
Subject: Date vs. Datetime boundaries
Date: Tue, 25 Aug 1998 15:52:39 -0500 (CDT)
Message-ID: <199808252052.PAA07004@Venus.mcs.net> (raw)

Are the 'extract' values off on the boundary values of date data types?
(With pgsql 6.3.2):

create table dtest (
  adate date,
  adt   datetime
);

insert into dtest values ('01-01-1998', '01-01-1998')  ;
insert into dtest values ('01-31-1998', '01-31-1998')  ;
insert into dtest values ('02-01-1998', '02-01-1998')  ;
insert into dtest values ('02-02-1998', '02-02-1998')  ;

select extract (month from adate), extract (month from adt), * from dtest ;

date_part|date_part|     adate|adt                         
---------+---------+----------+----------------------------
       12|        1|01-01-1998|Thu Jan 01 00:00:00 1998 CST
        1|        1|01-31-1998|Sat Jan 31 00:00:00 1998 CST
        1|        2|02-01-1998|Sun Feb 01 00:00:00 1998 CST
        2|        2|02-02-1998|Mon Feb 02 00:00:00 1998 CST
(4 rows)
---
select * from dtest where extract(month from adate) = 12;
     adate|adt                         
----------+----------------------------
01-01-1998|Thu Jan 01 00:00:00 1998 CST
(1 row)
-----
  Les Mikesell
   les@mcs.com



Message-ID: <199808252052.PAA07004@Venus.mcs.net>
Permalink:  ../199808252052.PAA07004@Venus.mcs.net/
Also on:    postgresql.org/message-id/199808252052.PAA07004@Venus.mcs.net

 · 

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-sql@postgresql.org
  Cc: les@Mcs.Net
  Subject: Re: Date vs. Datetime boundaries
  In-Reply-To: <199808252052.PAA07004@Venus.mcs.net>
  References: <199808252052.PAA07004@Venus.mcs.net>

* 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