Re: Casts question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Casts question
Дата
Msg-id 16984.1087912004@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Casts question  (Shachar Shemesh <psql@shemesh.biz>)
Список 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 по дате отправления:

Предыдущее
От: "Dave Page"
Дата:
Сообщение: Re: Compile failure with SSL
Следующее
От: Gaetano Mendola
Дата:
Сообщение: warning missing