pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Roland_DUBOULOZ <Roland.Dubouloz@bull.net>
To: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Bad date representation
Date: Sun, 11 Jul 1999 17:57:33 +0300
Message-ID: <l03130306b3ae6060caff@[147.233.159.109]> (raw)
In-Reply-To: <3785BFF9.B569809@bull.net>

At 12:25 +0300 on 09/07/1999, Roland_DUBOULOZ wrote:


> 2.-postmaster -i
>
>   insert into FOO values('06-22-1999');
>   insert into FOO values('06-07-1999');
>   insert into FOO values('23-06-1999');  <---- no ERROR
>    WE Have NO ERROR !!!!! why ???
>
> and on select * from FOO the result is
>
> 	date
>   ----------
>   06-22-1999
>   06-07-1999
>   06-23-1999

The way Postgres parses dates is: first, see if there is more than one way
to interpret the date. If there is more than one way, use the DateStyle.

So, if it sees a date like 23-06-1999, there is only one way to interpret
it - that the 23 is the day, and the 06 is the month. In that case, this is
June 23rd, and everything is OK. But a date like 08-06-1999 could be either
August sixth or June eighth. In that case, it uses the DateStyle to
determine which.

This algorithm gives you some lenience.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





view thread (2+ messages)

Message-ID: <l03130306b3ae6060caff@[147.233.159.109]>
Permalink:  ../l03130306b3ae6060caff@%5B147.233.159.109%5D/
Also on:    postgresql.org/message-id/l03130306b3ae6060caff@[147.233.159.109]

 · 

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: herouth@oumail.openu.ac.il, Roland.Dubouloz@bull.net
  Subject: Re: [SQL] Bad date representation
  In-Reply-To: <l03130306b3ae6060caff@[147.233.159.109]>
  References: <3785BFF9.B569809@bull.net> <l03130306b3ae6060caff@[147.233.159.109]>

* 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