Re: BUG #5028: CASE returns ELSE value always when type is"char"

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-bugs(at)postgresql(dot)org, Sam Mason <sam(at)samason(dot)me(dot)uk>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: BUG #5028: CASE returns ELSE value always when type is"char"
Date: 2009-09-02 14:50:05
Message-ID: 407d949e0909020750q40c2b695h2cf53bc86baf2a1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Sep 2, 2009 at 3:44 PM, Jeff Davis<pgsql(at)j-davis(dot)com> wrote:
> On Wed, 2009-09-02 at 08:57 -0500, Kevin Grittner wrote:
>> >   (a) leaving a literal as "unknown" until you've finished
>> >       inferring types (current behavior)
>> >   (b) casting every unknown to text immediately, and then trying to
>> >       infer the types
>>
>> No, that's not it.  I'm wondering why it isn't treated as text.
>> Period.  Full stop.  Nothing to infer.  Anywhere that we have implicit
>> casts defined from text to something else could, of course, still
>> operate; but it would be text.  No guessing.
>
> If you have very many implicit casts, I think you lose the
> predictability and safety you're looking for, and/or end up with a lot
> of errors that eliminate the convenience of implicit casting.

Perhaps we should stop thinking of "unknown" as, er, "unknown" and
think of it as "text literal". A text literal has implicit casts to
every data type but a normal text string has to be explicitly cast.

Hm, that's not quite right because things like array(1)||'5' don't
treat the '5' as a text literal. The "implicit cast" is preferred to
treating it as text.

--
greg
http://mit.edu/~gsstark/resume.pdf

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2009-09-02 14:52:10 Re: BUG #5028: CASE returns ELSE value always when typeis"char"
Previous Message Jeff Davis 2009-09-02 14:44:36 Re: BUG #5028: CASE returns ELSE value always when type is"char"