Search Postgresql Archives

Re: Problems with casting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Nasby <Jim.Nasby@xxxxxxxxxxxxxx> writes:
> I've created a variant data type [1]. It seems to work pretty well, 
> except for some issues with casting.

> Since the idea of the type is to allow storing any other data type, it 
> creates casts to and from all other types. At first these were all 
> marked as ASSIGNMENT, but that made using variant with functions quite 
> cumbersome. With functions that accepted a variant, you still had to 
> explicitly cast it:

> SELECT variant_function( some_field::variant.variant ) FROM some_table;

> I was reluctant to make the casts to variant IMPLICIT, but it seems like 
> it actually works rather well... except for arrays:

I suspect that that's only the tip of the iceberg.  Remember the mess
we had with implicit casts to text?  And those only existed for a dozen
or so types, not for everything.  Every function or operator you define
for "variant" is going to be a loaded gun just waiting to shoot your foot
off, if you make all those casts implicit.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux