pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
date format in 7.4
4+ messages / 4 participants
[nested] [flat]

* date format in 7.4
@ 2004-02-20 14:58 Silke Trissl <trissl@informatik.hu-berlin.de>
  2004-02-20 15:27 ` Re: date format in 7.4 scott.marlowe <scott.marlowe@ihs.com>
  2004-02-20 15:32 ` Re: date format in 7.4 Tom Lane <tgl@sss.pgh.pa.us>
  2004-02-20 15:57 ` Re: date format in 7.4 Richard Huxton <dev@archonet.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Silke Trissl @ 2004-02-20 14:58 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I have an application where users can enter the date via a web interface.

Recently I upgrated my PostgreSQL version from 7.3 to 7.4.1.

On 7.3 I run several tests about the format of the date and found,
that Postgres accepts almost everything. Today I found out, that 7.4.1 
only accepts dates in the format mm-dd-yy, although the documentation 
still states the following
#

    5.

       Otherwise the date field ordering is assumed to follow the 
DateStyle setting: mm-dd-yy, dd-mm-yy, or yy-mm-dd. Throw an error if a 
month or day field is found to be out of range.

#
ref: http://www.postgresql.org/docs/7.4/interactive/datetime-appendix.html

Does anyone know, if it is intentional to restrict it to mm-dd-yy format 
or is is just a bug of 7.4.1?

Thanks in advance for any suggestions

Silke




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: date format in 7.4
  2004-02-20 14:58 date format in 7.4 Silke Trissl <trissl@informatik.hu-berlin.de>
@ 2004-02-20 15:27 ` scott.marlowe <scott.marlowe@ihs.com>
  2 siblings, 0 replies; 4+ messages in thread

From: scott.marlowe @ 2004-02-20 15:27 UTC (permalink / raw)
  To: Silke Trissl <trissl@informatik.hu-berlin.de>; +Cc: pgsql-sql

On Fri, 20 Feb 2004, Silke Trissl wrote:

> Hi,
> 
> I have an application where users can enter the date via a web interface.
> 
> Recently I upgrated my PostgreSQL version from 7.3 to 7.4.1.
> 
> On 7.3 I run several tests about the format of the date and found,
> that Postgres accepts almost everything. Today I found out, that 7.4.1 
> only accepts dates in the format mm-dd-yy, although the documentation 
> still states the following
> #
> 
>     5.
> 
>        Otherwise the date field ordering is assumed to follow the 
> DateStyle setting: mm-dd-yy, dd-mm-yy, or yy-mm-dd. Throw an error if a 
> month or day field is found to be out of range.
> 
> #
> ref: http://www.postgresql.org/docs/7.4/interactive/datetime-appendix.html
> 
> Does anyone know, if it is intentional to restrict it to mm-dd-yy format 
> or is is just a bug of 7.4.1?

It is intentional.  But, it's not as restricted as you might think.

You can set the style to one of several ways you can set it.

http://www.postgresql.org/docs/7.4/static/datatype-datetime.html

the idea behind fixing this in 7.4 was that if you set a date style of
SQL, DMY then it would be wring for the database to access a date of 
3/14/04 and convert it to March 14th, since your date style said that 
march 14th should come in as 14/03/04.

I.e. it's better at checking ranges and throwing out the ones that don't 
fit.  Better to have a problem getting the wrong data into the database 
than trying to get it back out a couple years down the road.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: date format in 7.4
  2004-02-20 14:58 date format in 7.4 Silke Trissl <trissl@informatik.hu-berlin.de>
@ 2004-02-20 15:32 ` Tom Lane <tgl@sss.pgh.pa.us>
  2 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2004-02-20 15:32 UTC (permalink / raw)
  To: Silke Trissl <trissl@informatik.hu-berlin.de>; +Cc: pgsql-sql

Silke Trissl <trissl@informatik.hu-berlin.de> writes:
> On 7.3 I run several tests about the format of the date and found,
> that Postgres accepts almost everything. Today I found out, that 7.4.1 
> only accepts dates in the format mm-dd-yy,

It now requires the field order to be what DateStyle says it is.  See
the very voluminous flamewar about ambiguous date input handling in the
pgsql-hackers archives from last summer.

> although the documentation still states the following

AFAICS the documentation says so too...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: date format in 7.4
  2004-02-20 14:58 date format in 7.4 Silke Trissl <trissl@informatik.hu-berlin.de>
@ 2004-02-20 15:57 ` Richard Huxton <dev@archonet.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Richard Huxton @ 2004-02-20 15:57 UTC (permalink / raw)
  To: Silke Trissl <trissl@informatik.hu-berlin.de>; pgsql-sql

On Friday 20 February 2004 14:58, Silke Trissl wrote:
> Hi,
>
> I have an application where users can enter the date via a web interface.
>
> Recently I upgrated my PostgreSQL version from 7.3 to 7.4.1.
>
> On 7.3 I run several tests about the format of the date and found,
> that Postgres accepts almost everything. Today I found out, that 7.4.1
> only accepts dates in the format mm-dd-yy, although the documentation
> still states the following

>     5.
>        Otherwise the date field ordering is assumed to follow the
> DateStyle setting: mm-dd-yy, dd-mm-yy, or yy-mm-dd. Throw an error if a
> month or day field is found to be out of range.

I think what happened is that it will now *only* accept the format specified 
by your datestyle setting. Previously, as you say, it would have a guess at 
almost anything (and sometimes get it wrong).


-- 
  Richard Huxton
  Archonet Ltd



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2004-02-20 15:57 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-02-20 14:58 date format in 7.4 Silke Trissl <trissl@informatik.hu-berlin.de>
2004-02-20 15:27 ` scott.marlowe <scott.marlowe@ihs.com>
2004-02-20 15:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-02-20 15:57 ` Richard Huxton <dev@archonet.com>

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