Skip site navigation (1) Skip section navigation (2)

Re: Domain casting still not working right?

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Domain casting still not working right?
Date: 2003-05-24 17:38:00
Message-ID: 1053797879.279.123.camel@jester (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
It's because of the coerce_to_target_type string hack:

/*
 * String hacks to get transparent conversions for char and varchar:
 * if a coercion to text is available, use it for forced coercions to
 * char(n) or varchar(n).
 *
 * This is pretty grotty, but seems easier to maintain than providing
 * entries in pg_cast that parallel all the ones for text.
 */


This hack works on the provided target type and not on the base target
type.  Attached is a patch to goto the base type for this hack (fix the
if)


On Fri, 2003-05-23 at 18:35, Peter Eisentraut wrote:
> This particular case arose during work on the information schema:
> 
> -- good
> 
> select cast(55::oid AS varchar);
>  varchar
> ---------
>  55
> (1 row)
> 
> -- bad
> 
> create domain test as varchar;
> CREATE DOMAIN
> select cast(55::oid AS test);
> ERROR:  Cannot cast type oid to test
-- 
Rod Taylor <rbt(at)rbt(dot)ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2003-05-24 19:02:55
Subject: Re: Roadmap for FE/BE protocol redesign
Previous:From: Bruce MomjianDate: 2003-05-24 17:37:14
Subject: Re: XML ouput for psql

pgsql-patches by date

Next:From: Tom LaneDate: 2003-05-24 21:41:31
Subject: Re: Domain casting still not working right?
Previous:From: Bruce MomjianDate: 2003-05-24 17:37:14
Subject: Re: XML ouput for psql

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group