X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0366DD1B451 for ; Thu, 27 Nov 2003 14:11:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 86103-01 for ; Thu, 27 Nov 2003 10:11:26 -0400 (AST) Received: from dyatel.antar.bryansk.ru (unknown [195.239.214.85]) by svr1.postgresql.org (Postfix) with ESMTP id 00947D1B431 for ; Thu, 27 Nov 2003 10:11:22 -0400 (AST) Received: from fduch by dyatel.antar.bryansk.ru with local (Exim 4.24; FreeBSD) id 1APMrd-000Gqb-LI for pgsql-sql@postgresql.org; Thu, 27 Nov 2003 17:11:25 +0300 Date: Thu, 27 Nov 2003 17:11:25 +0300 From: "Alexander M. Pravking" To: pgsql-sql@postgresql.org Subject: Validity check in to_date? Message-ID: <20031127141125.GC87728@dyatel.antar.bryansk.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/304 X-Sequence-Number: 16119 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