[BUGS] BUG #5438: Bug/quirk in ascii() function

2010-04-26 Thread Christoph Zwerschke
The following bug has been logged online: Bug reference: 5438 Logged by: Christoph Zwerschke Email address: c...@online.de PostgreSQL version: 8.0-8.4 Operating system: all Description:Bug/quirk in ascii() function Details: As you would expect, ascii(cast(' '

Re: [BUGS] BUG #5438: Bug/quirk in ascii() function

2010-04-26 Thread Takahiro Itagaki
Christoph Zwerschke c...@online.de wrote: ascii(cast(' ' as char(1))), ascii(cast(' ' as char)) both give 0. I think this quirk should be fixed or at least mentioned in the documentation of ascii(). The problem is not in ascii(), but in casting from char to text. We have only one

Re: [BUGS] BUG #5438: Bug/quirk in ascii() function

2010-04-26 Thread Christoph Zwerschke
Am 26.04.2010 12:11, schrieb Takahiro Itagaki: The problem is not in ascii(), but in casting from char to text. We have only one version of ascii() in default; ascii(text). So, if you use ascii( ' '::char(1) ), it is actually handled as ascii( ' '::char(1)::text ). Traling spaces were removed

Re: [BUGS] BUG #5438: Bug/quirk in ascii() function

2010-04-26 Thread Kevin Grittner
Christoph Zwerschke c...@online.de wrote: Am 26.04.2010 12:11, schrieb Takahiro Itagaki: Do you know how the SQL standard mention the behavior? IMHO, postgres' behavior is more reasonable because length(' '::char(1)) is 0. Just found http://troels.arvin.dk/db/rdbms/ which claims that this