Re: BUG #5225: create table: cast necessary for constant??

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kurt wagner <kurt(dot)wagnerextern(at)leoni(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5225: create table: cast necessary for constant??
Date: 2009-12-02 16:46:56
Message-ID: 4B169A00.6010504@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 3/12/2009 12:35 AM, Tom Lane wrote:
> "Kurt wagner"<kurt(dot)wagnerextern(at)leoni(dot)com> writes:
>> During migration from Informix to Postgres I came across following issue:
>> create temp table temp1 as
>> SELECT firmnr,
>> werknr,
>> 'I' as invper,
>> invnum
>> from .... ;
>
> You really ought to cast the 'I' to some specific type.

It's usually neatest to do this by just explicitly identifying the
intended type in the first place, eg:

SELECT firmnr,
werknr,
TEXT 'I' as invper,
invnum
from .... ;

... which, IIRC, is the standard way to do it. I don't have a copy to
check against to be sure.

Personally, I like the fact that Pg errs on the side of caution here
rather than guessing what you want.

--
Craig Ringer

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2009-12-02 17:00:27 Re: BUG #5226: Limit operator slows down
Previous Message Craig Ringer 2009-12-02 16:42:38 Re: BUG #5226: Limit operator slows down