Re: when are the xxxin() functions called - Mailing list pgsql-hackers

From Amit Langote
Subject Re: when are the xxxin() functions called
Date
Msg-id 554C0C92.6020000@lab.ntt.co.jp
Whole thread Raw
In response to when are the xxxin() functions called  (Rui Hai Jiang <ruihaijiang@msn.com>)
List 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




pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: commitfest app bug/feature
Next
From: Peter Eisentraut
Date:
Subject: Re: "Bugs" CF?