Re: [HACKERS] parse_coerce question - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] parse_coerce question
Date
Msg-id 199908042344.TAA08004@candle.pha.pa.us
Whole thread Raw
In response to parse_coerce question  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> Looking into this, I find that the reason for the difference is that
> parse_coerce() only performs parse-time coercion of constants if they
> are of type UNKNOWNOID --- ie, the constant is of string type.  And
> indeed
>     ... WHERE float8column < '33';
> produces a pre-coerced float8 constant!  But make_const produces type
> INT4OID or INT8OID for integer or float constants.
> 
> It seems to me that parse_coerce ought to do parse-time coercion if
> the input tree is a constant of either UNKNOWNOID, INT4OID, or FLOAT8OID
> type, and only fall back to inserting a function call if it's unable
> to do the coercion.  Am I missing anything?

You are right.  The textin/out trick is an old one, and one we only did
because we _had_ to make some conversion at that point.  No problem
making it more general.


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: parse_coerce question
Next
From: Tatsuo Ishii
Date:
Subject: INTERSECT/EXCEPT and duplicates?