Re: BUG #5225: create table: cast necessary for constant?? - Mailing list pgsql-bugs

From Craig Ringer
Subject Re: BUG #5225: create table: cast necessary for constant??
Date
Msg-id 4B169A00.6010504@postnewspapers.com.au
Whole thread Raw
In response to Re: BUG #5225: create table: cast necessary for constant??  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #5225: create table: cast necessary for constant??
List pgsql-bugs
On 3/12/2009 12:35 AM, Tom Lane wrote:
> "Kurt wagner"<kurt.wagnerextern@leoni.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

pgsql-bugs by date:

Previous
From: Craig Ringer
Date:
Subject: Re: BUG #5226: Limit operator slows down
Next
From: Robert Haas
Date:
Subject: Re: BUG #5226: Limit operator slows down