From: | Shachar Shemesh <psql(at)shemesh(dot)biz> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Casts question |
Date: | 2004-06-20 20:10:37 |
Message-ID: | 40D5EF3D.6040802@shemesh.biz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
>Shachar Shemesh <psql(at)shemesh(dot)biz> writes:
>
>
>>I have defined a datatype called "varcharci", shamelessly yanking the
>>input, output, recv and send functions from varchar. This means (as far
>>as I understand things) that this type is binary compatible with varchar.
>>
>>
>
>Use text, not varchar.
>
>
>
>>Why is that? Being as it is that no operator = is defined for varcharci,
>>and that the cast from varchar to varcharci is "as assignment" anyways,
>>shouldn't postgres be able to do the cast implicitly?
>>
>>
>
>Yes, it can cast to varchar, but that doesn't help because there are no
>varchar operators ;-). To resolve the operator, it has to promote both
>sides to text, and you didn't offer a cast to text.
>
> regards, tom lane
>
>
>
I don't get it. The cast from varchar to text is using a "no function"
cast - i.e. - they are binary compatible. And yet, there are two
seperate functions for receiving from text and from binary
representation. Why not use the same function?
Shachar
--
Shachar Shemesh
Lingnu Open Source Consulting ltd.
http://www.lingnu.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-06-20 20:37:16 | Re: nested xacts and phantom Xids |
Previous Message | Oliver Jowett | 2004-06-20 13:54:49 | Re: [HACKERS] JDBC prepared statements: actually not server prepared |