[Info-ingres] When is an empty string an integer?

Karl Schendel schendel at kbcomputer.com
Wed May 11 13:19:26 UTC 2016


I'd much rather that it be an error than a zero.

I agree with Ian that it would be chancy to try to change it now.  I guess we
need to implement the:
backwards_compatibility_all_bugs: FALSE
configuration option.  :-)

Karl

> On May 11, 2016, at 9:16 AM, Martin Bowes <martin.bowes at ndph.ox.ac.uk> wrote:
> 
> Hi Ian,
>  
> I don’t see this as a bug, just a state of play. Might be a good idea for it to be documented in the SQL guide somewhere but that’s as far as I’d go.
>  
> FYI. Geraint Jones has informed me that:
> Various DBMS’s disagree on how to handle cast(‘’ as integer).
>  
> Ingres : 0.
> Oracle : NULL.
> Postgres : Error.
> MySQL : 0.
>  
> Marty
>  
> From: Ian Kirkham [mailto:Ian.Kirkham at actian.com] 
> Sent: 11 May 2016 13:51
> To: Martin Bowes; info-ingres at lists.planetingres.org
> Subject: RE: [Info-ingres] When is an empty string an integer?
>  
> Hi Marty,
> Historically Ingres has always treated a string of just zero or more space characters as numeric 0 on conversion to integers.
> MS excel does the same so it must be an industry standard - J
> Not something we could easily correct now.
> Regards,
> Ian
> From: info-ingres-bounces at lists.planetingres.org [mailto:info-ingres-bounces at lists.planetingres.org] On Behalf Of Martin Bowes
> Sent: 11 May 2016 13:42
> To: info-ingres at lists.planetingres.org
> Subject: [Info-ingres] When is an empty string an integer?
>  
> Hi All,
>  
> This is probably documented behaviour but I’m having a hard time finding it. So if someone could point me at the document I’d be happy.
>  
> What is the expected result of: select integer(varchar('', 1))
>  
> The answer is zero.
>  
> I must concede I can sort of see this as being necessary, but I’m curious as to why we just didn’t get the standard error:
> E_US100F String cannot be converted to numeric due to incorrect syntax.
>  
> Martin Bowes
>  
>  
>  
>  
> _______________________________________________
> Info-ingres mailing list
> Info-ingres at lists.planetingres.org
> http://lists.planetingres.org/mailman/listinfo/info-ingres




More information about the Info-ingres mailing list