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 5C10FD1D314 for ; Tue, 2 Dec 2003 10:31:31 +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 89848-03 for ; Tue, 2 Dec 2003 06:31:01 -0400 (AST) Received: from dyatel.antar.bryansk.ru (unknown [195.239.214.85]) by svr1.postgresql.org (Postfix) with ESMTP id 54F86D1D6B9 for ; Tue, 2 Dec 2003 06:30:59 -0400 (AST) Received: from fduch by dyatel.antar.bryansk.ru with local (Exim 4.24; FreeBSD) id 1AR7o3-0007gI-TV; Tue, 02 Dec 2003 13:30:59 +0300 Date: Tue, 2 Dec 2003 13:30:59 +0300 From: "Alexander M. Pravking" To: Christoph Haller Cc: pgsql-sql@postgresql.org Subject: Re: Validity check in to_date? Message-ID: <20031202103059.GG87728@dyatel.antar.bryansk.ru> References: <20031127141125.GC87728@dyatel.antar.bryansk.ru> <200312020927.KAA17321@rodos> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <200312020927.KAA17321@rodos> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/13 X-Sequence-Number: 16179 On Tue, Dec 02, 2003 at 10:27:04AM +0100, Christoph Haller wrote: > As far as I know these results are correct in terms of the underlying > C-library function mktime(). This function is intended to be used when > adding/subtracting intervals from a given timestamp. Which one? mktime() or to_date()? I'm not sure it's handy to use to_date() for any calculations, so I'm surprised why doesn't it work just as date_in() do. > I don't know of any postgres function doing the check you're looking for. Yes, the only thing I could think now is to do something like s/([0-9]+)\.([0-9]+)\.([0-9]+)/\3-\2-\1/ and then pass it to CAST(... AS date) using ISO DateStyle. (I could simply use German DateStyle in case of DD.MM.YYYY, but I deal with several date formats, e.g. DD/MM/YYYY.) > But I can't believe this is the first time this topic is brought up. > You may search the archives on "date plausibility" are related terms. I'm sure too, but it's really hard to find a good keyword sequence when searching such sort of things :( Anyway, thank you for attention. -- Fduch M. Pravking