pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander M. Pravking <fduch@antar.bryansk.ru>
To: pgsql-sql@postgresql.org
Subject: Validity check in to_date?
Date: Thu, 27 Nov 2003 17:11:25 +0300
Message-ID: <20031127141125.GC87728@dyatel.antar.bryansk.ru> (raw)

I just discovered that to_date() function does not check if supplied
date is correct, giving surprising (at least for me) results:

fduch=# SELECT to_date('31.11.2003', 'DD.MM.YYYY');
  to_date
------------
 2003-12-01

or even

fduch=# SELECT to_date('123.45.2003', 'DD.MM.YYYY');
  to_date
------------
 2007-01-03

to_timestamp() seems to work the same way. It's probably useful sometimes,
but not in my case... Is it how it supposed to work?
If so, how can I do such a validity check?
If not, has something changed in 7.4?

In any case, I have to find a workaround now and will appreciate any help.


fduch=# SELECT version();
                               version
---------------------------------------------------------------------
 PostgreSQL 7.3.4 on i386-portbld-freebsd4.8, compiled by GCC 2.95.4


-- 
Fduch M. Pravking



view thread (11+ messages)  latest in thread

Message-ID: <20031127141125.GC87728@dyatel.antar.bryansk.ru>
Permalink:  ../20031127141125.GC87728@dyatel.antar.bryansk.ru/
Also on:    postgresql.org/message-id/20031127141125.GC87728@dyatel.antar.bryansk.ru

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: fduch@antar.bryansk.ru
  Subject: Re: Validity check in to_date?
  In-Reply-To: <20031127141125.GC87728@dyatel.antar.bryansk.ru>

* 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