Re: Casts question - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Casts question
Date
Msg-id 16984.1087912004@sss.pgh.pa.us
Whole thread Raw
In response to Re: Casts question  (Shachar Shemesh <psql@shemesh.biz>)
List pgsql-hackers
Shachar Shemesh <psql@shemesh.biz> writes:
> What I don't understand is this. The cast from varchar to text is a 
> no-function one. I.e. - they are defined to be memory-represented the 
> same. If that is the case, one would expect them to also share the input 
> and ouput functions. When looking at the catalog, however, it appears 
> that textin is used to input text, while varcharin is used for varchars.

Sure.  Identical internal representation does not necessarily imply
identical functionality.  varcharin needs to enforce a maximum length
(and now that I think of it, varcharrecv does too; that's an oversight).

Another example is that abstime is binary-compatible to integer.  Should
they have the same input function?

> It gets wierder. The binary receive function for varchar (varcharrecv) 
> is different than the one for text (textrecv), but the C implementation 
> of the former simply calls the C implementation of the later. Why not 
> define them to be the same at the SQL level?

So we can fix bugs like the one above without forcing initdb.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: Re: Compile failure with SSL
Next
From: Gaetano Mendola
Date:
Subject: warning missing