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

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

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
>> If I understand your question, you're comparing:
>>
>> (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.

Because then we would have to provide implicit casts from text to
everything else, which would be horribly dangerous.

> In my view, it is wrong that any of those work. I would expect to
> have to code one of these:

> select now() < date '2009-01-01'; -- implicit casts should cover
> select now() < timestamp with time zone '2009-01-01 00:00:00.0';

[ shrug... ] The current design is a compromise between usability
and strictness of semantics. This proposal appears to be all strictness
and no usability. No thanks ... even without any backward-compatibility
considerations, I wouldn't find this to be an improvement.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2009-09-02 14:24:53 Re: BUG #5028: CASE returns ELSE value always when type is"char"
Previous Message Kevin Grittner 2009-09-02 13:57:28 Re: BUG #5028: CASE returns ELSE value always when type is"char"