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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: BUG #2490: '||' and type casting for user defined types



"Nikolay Samokhvalov" <pg-bugs(at)samokhvalov(dot)com> writes:
> CREATE CAST (aaa AS text) WITHOUT FUNCTION
> 	AS IMPLICIT;
> CREATE CAST (text AS aaa) WITHOUT FUNCTION
> 	AS IMPLICIT;

> trash=# select ('as' || 'df')::aaa;
>  aaa  
> ------
>  asdf
> (1 row)

> In the last case, function aaa_in() wasn't invoked at all and we obtained 
> the sting of type aaa with length > 3...

Well, sure.  You declared the text to aaa cast as WITHOUT FUNCTION; that
says the system can relabel any legal text value as an aaa.  If you want
to enforce a length limit on the cast result, you need to write a cast
function that does it.

			regards, tom lane



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group