Re: Casts question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Shachar Shemesh <psql(at)shemesh(dot)biz>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Casts question
Date: 2004-06-22 13:46:44
Message-ID: 16984.1087912004@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Shachar Shemesh <psql(at)shemesh(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gaetano Mendola 2004-06-22 22:37:43 warning missing
Previous Message Kreißl, Karsten 2004-06-22 09:50:22 User Privileges using dblink