X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C863AD1BA5E for ; Mon, 7 Jun 2004 10:53:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99431-07 for ; Mon, 7 Jun 2004 13:54:00 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 4319BD1B435 for ; Mon, 7 Jun 2004 10:53:55 -0300 (ADT) Received: (qmail 16842 invoked by uid 500); 7 Jun 2004 13:59:44 -0000 Date: Mon, 7 Jun 2004 08:59:44 -0500 From: Bruno Wolff III To: sad Cc: pgsql-sql@postgresql.org Subject: Re: empty string casting to typed value Message-ID: <20040607135944.GA16564@wolff.to> Mail-Followup-To: sad , pgsql-sql@postgresql.org References: <200406071037.44547.sad@bankir.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200406071037.44547.sad@bankir.ru> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/53 X-Sequence-Number: 17998 On Mon, Jun 07, 2004 at 10:37:44 +0400, sad wrote: > Hello > > It is clear that '' is a bad integer or timestamp representation > > but during the user input NULLs are usually represented with empty strings > sometimes bunch of 'if empty' instructions grows huge > (and in case of casting to timestamp apostrophes make sense) An empty string is not an obvious particular time. Different applications might treat this differently. Not applicable, missing, and current time are all reasonable defaults. > > Why you prohibit casting ''::int to NULL ? > What would you advice ? The application should handle mapping appropiate inputs to NULL or perhaps DEFAULT.