Date vs. Datetime boundaries - Mailing list pgsql-sql

From Leslie Mikesell
Subject Date vs. Datetime boundaries
Date
Msg-id 199808252052.PAA07004@Venus.mcs.net
Whole thread Raw
List pgsql-sql
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

pgsql-sql by date:

Previous
From: "Taral"
Date:
Subject: RE: [SQL] Having problems to compile SPI
Next
From: Leslie Mikesell
Date:
Subject: excel vs. money data type?