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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kurt wagner" <kurt(dot)wagnerextern(at)leoni(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5225: create table: cast necessary for constant??
Date: 2009-12-02 16:35:01
Message-ID: 14532.1259771701@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"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. The above code
is illegal per SQL standard. You can get away with it in certain
contexts in Postgres, but when you are creating a table or view and
don't know exactly what might be done with the column, it's much better
to ensure it's of the intended type. We aren't going to make it default
to text or whatever because it's not always clear that that's what's
intended --- consider

'1.2' as invper,
'2009-11-23' as invper,

Most likely text was not what the writer had in mind in such cases.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2009-12-02 16:42:38 Re: BUG #5226: Limit operator slows down
Previous Message Craig Ringer 2009-12-02 16:12:54 Re: BUG #5224: After upgrading from vista to windows 7, postgres services are missing