pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Marc G. Fournier <scrappy@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: ALTER TABLE ( smallinto -> boolean ) ...
Date: Thu, 01 Sep 2005 17:30:42 -0400
Message-ID: <6793.1125610242@sss.pgh.pa.us> (raw)
In-Reply-To: <4317713C.10808@dunslane.net>
References: <20050829201253.X1044@ganymede.hub.org>
	<15013.1125359379@sss.pgh.pa.us>
	<20050901174341.N1044@ganymede.hub.org>
	<6399.1125608205@sss.pgh.pa.us>
	<4317713C.10808@dunslane.net>

Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> Sure you can.  Make a SQL or PLPGSQL function that does the conversion
>> you want and then create a cast using it.

> That probably won't help him much with "values(0)":

If I remember the context of the original request, it wasn't about that
anyway, but about dealing with an existing smallint column.

> Is there a way to make the builtin int to bool cast implicit?

I think you'd have to go and hack the pg_cast entry ... but that cast is
new in 8.1 anyway, so it doesn't apply to Marc's problem (yet).

If we want to make it cover that specific scenario, changing it to AS
ASSIGNMENT would be sufficient; I don't think it needs to be IMPLICIT.
(I generally find cross-type-category implicit casts to be dangerous.)

			regards, tom lane



view thread (13+ messages)  latest in thread

Message-ID: <6793.1125610242@sss.pgh.pa.us>
Permalink:  ../6793.1125610242@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6793.1125610242@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andrew@dunslane.net, scrappy@postgresql.org, pgsql-hackers@postgresql.org
  Subject: Re: ALTER TABLE ( smallinto -> boolean ) ...
  In-Reply-To: <6793.1125610242@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox