Re: Update existing system explicit cast to make it implicit

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: asia123321(at)op(dot)pl
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Update existing system explicit cast to make it implicit
Date: 2011-01-31 16:13:55
Message-ID: 17594.1296490435@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

asia123321(at)op(dot)pl writes:
> I am trying to use bit(1) datatype with existing application that used int datatype before.
> So I tried to create implicit cast that will allow me not to make code modifications and wanted to create implicit cast "int2bit", but it turned out that there is already system cast.
> Unfortunately this cast is explicit and I need to make it implicit (it can be made implicit only for one schema).

You will likely find that this is a really bad idea. Implicit
casts between fundamentally different datatypes are *dangerous*.
They tend to result in either surprising query behaviors or unexpected
"operator is not unique" failures. Fixing the app would be a lot safer
in the long run.

> My question is that if there is any official way to overwrite this attribute

No. If you're intent on breaking things, hacking the catalog is what to do.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ben Chobot 2011-01-31 16:35:39 Re: Hit by the out of memory killer last night
Previous Message Jerry LeVan 2011-01-31 16:09:20 Create Table Question...