Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmsv5-00043d-47 for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Sep 2016 01:35:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bmsv4-0005Ay-NL for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Sep 2016 01:35:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bmsv4-0005As-5B for pgsql-hackers@postgresql.org; Thu, 22 Sep 2016 01:35:22 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bmsv0-0008Kf-NR for pgsql-hackers@postgresql.org; Thu, 22 Sep 2016 01:35:21 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 483982060D; Wed, 21 Sep 2016 21:35:16 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 21 Sep 2016 21:35:16 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=fUrPwL9NpDKjG7k B2dccYOPa20U=; b=IOWC0eo/REHTlTh4VL8UW8yTc/P+4ovd9W3CKyWS5nIovY/ jB79heMDoETMgKKlpIKwjWkXHC/qdAYOdlCtJxty/fKVYhPpckleXmcQ3dpX0EeT 23UG4wt2X3BQ8mZoawa8hB2CMaJMzJ5YtaUsmQOEdPhoBZGGLOvLtJJYU6h8= X-Sasl-enc: O2lEAWBw7aIU5rzkmqE5Fq9Gh8A0lqfcaFC1aySTiUCb 1474508116 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id C73BCCCEA1; Wed, 21 Sep 2016 21:35:15 -0400 (EDT) Subject: Re: to_date_valid() To: Andreas 'ads' Scherbaum , Artur Zakirov , "Joshua D. Drake" , Albe Laurenz , 'Andreas Karlsson *EXTERN*' , Pavel Stehule References: <57786490.9010201@wars-nicht.de> <5778EA94.1020706@wars-nicht.de> <2bc6bcef-cada-1ac7-f9a2-2f6128ca4c3c@proxel.se> <579823DF.3080903@commandprompt.com> <95738e12-6ed6-daf5-9dcf-6336072e6b15@postgrespro.ru> <81ed5480-9bca-361b-9aa0-cbafc2ec2f63@wars-nicht.de> <7fde7a91-0ad3-33ac-c348-cf58e4638464@2ndquadrant.com> Cc: Jaime Casanova , Euler Taveira , Pg Hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Wed, 21 Sep 2016 21:35:15 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 9/9/16 4:48 AM, Andreas 'ads' Scherbaum wrote: > ValidateDate() will tell you if it's a valid date. But not if the > transformation was correct: > > postgres=# SELECT to_date('2011 12 18', 'YYYY MM DD'); > to_date > ------------ > 2011-12-08 > (1 row) > > (with the patch from Artur) > > > Any idea how to solve this problem? I think we need to do overflow checking as we read the various values, in do_to_timestamp() and functions called from it. This would be very similar to overflow checking in input functions. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers