Re: [HACKERS] parse_coerce question

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] parse_coerce question
Date: 1999-08-04 23:44:05
Message-ID: 199908042344.TAA08004@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 1999-08-05 01:13:59 INTERSECT/EXCEPT and duplicates?
Previous Message Tom Lane 1999-08-04 23:00:21 parse_coerce question