Re: when are the xxxin() functions called

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Rui Hai Jiang <ruihaijiang(at)msn(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: when are the xxxin() functions called
Date: 2015-05-08 01:08:34
Message-ID: 554C0C92.6020000@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-05-07 PM 11:49, Rui Hai Jiang wrote:
>
> I'm trying to figure out when the following functions are called,
>
> charin()
> int2in()
> int4in()
> textin()
>
> create table abcin( id integer, name varchar(10), title text);
> insert into abcin( id, name, title ) values (1,'tom', 'manager');
>
> The result is, textin() was called to handle 'manager' assigned to title, but
> charin(), int2in and int4in were not called.
>
> Does anyone know when are charin(),int2in() and int4in() called?
>

During parsing of the insert query, the values list (1,'tom', 'manager') is
transformed into an internal form during which it is determined that the first
value in the list can be represented as a machine integer - so it is evaluated
and stored for direct use later. Other literal values do not have such a
direct machine representation and require treatment (coercion to the target
type) using the input functions in later stages of query processing. By the
way, for the 'name' field, varcharin() would be used (not charin).

Thanks,
Amit

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2015-05-08 01:15:36 Re: "Bugs" CF?
Previous Message Michael Paquier 2015-05-08 00:30:14 Re: commitfest app bug/feature