Re: empty string casting to typed value - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: empty string casting to typed value
Date
Msg-id 20040607135944.GA16564@wolff.to
Whole thread Raw
In response to empty string casting to typed value  (sad <sad@bankir.ru>)
List pgsql-sql
On Mon, Jun 07, 2004 at 10:37:44 +0400, sad <sad@bankir.ru> 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.


pgsql-sql by date:

Previous
From: Karel Zak
Date:
Subject: Re: Formatting problems with negative intervals, TO_CHAR
Next
From: Stephan Szabo
Date:
Subject: Re: empty string casting to typed value