Re: DOMAIN NEED CAST ? - Mailing list pgsql-hackers

From Rod Taylor
Subject Re: DOMAIN NEED CAST ?
Date
Msg-id 1061138882.39706.99.camel@jester
Whole thread Raw
In response to DOMAIN NEED CAST ?  (ivan <iv@psycho.pl>)
Responses Re: DOMAIN NEED CAST ?
List pgsql-hackers
On Sun, 2003-08-17 at 12:34, ivan wrote:
> Why when i create domain like :
>
> CREATE DOMAIN alias_to_int AS INT;
>
> and then function like :
>
> CREATE FUNCTION func() RETURNS alist_to_int AS ' select 2::int; ' LANGUAGE
> SQL;
>
> and pg can not convert int to aliast_to_int, so i need to create cast for
> all this same types ?

PostgreSQL will not cast your function return results for you.

rbt=# create function func() returns integer as 'select 2::int2'
language sql;
ERROR:  return type mismatch in function: declared to return integer,
returns smallint



pgsql-hackers by date:

Previous
From: Shachar Shemesh
Date:
Subject: bidirectional cursors on views
Next
From: ivan
Date:
Subject: Re: DOMAIN NEED CAST ?