Re: declarations of range-vs-element <@ and @>
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Heikki Linnakangas <heikki@enterprisedb.com>, pgsql-hackers@postgreSQL.org
Date: 2011-11-17T20:50:20Z
Lists: pgsql-hackers
Attachments
- resolve-unknowns.patch (text/x-patch) patch
Jeff Davis <pgsql@j-davis.com> writes: > On Wed, 2011-11-16 at 16:41 -0500, Tom Lane wrote: >> I propose adding a step to func_select_candidate >> that tries to resolve things that way, ie, if all the known-type inputs >> have the same type, then try assuming that the unknown-type ones are of >> that type, and see if that leads to a unique match. There actually is a >> comment in there that claims we do that, but the code it's attached to >> is really doing something else that involves preferred types within >> type categories... >> >> Thoughts? > That sounds reasonable to me. Here's a draft patch (sans doc changes as yet) that extends the ambiguous-function resolution rules that way. It adds the heuristic at the very end, at the point where we would otherwise fail, and therefore it cannot change the system's behavior for any case that didn't previously draw an "ambiguous function/operator" error. I experimented with placing the heuristic earlier in func_select_candidate, but found that that caused some changes in regression test cases, which made me a bit nervous. Those changes were not clearly worse results, but this isn't an area that I think we should toy with lightly. I haven't yet tried again on changing the <@ and @> declarations, but will do that next. regards, tom lane