Re: RFD: schemas and different kinds of Postgres objects - Mailing list pgsql-hackers

From Thomas Swan
Subject Re: RFD: schemas and different kinds of Postgres objects
Date
Msg-id 3C4F2824.90709@ics.olemiss.edu
Whole thread Raw
In response to Re: RFD: schemas and different kinds of Postgres objects  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-hackers
Tom Lane wrote:<br /><blockquote cite="mid:3159.1011804418@sss.pgh.pa.us" type="cite"><pre wrap="">Stephan Szabo <a
class="moz-txt-link-rfc2396E"href="mailto:sszabo@megazone23.bigpanda.com"><sszabo@megazone23.bigpanda.com></a>
writes:<br/></pre><blockquote type="cite"><pre wrap="">Wouldn't it make sense to prefer operators/functions earlier in
thesearch<br />path for resolving ambiguity.  So if you had plus(int4, int4) in my<br />schema and plus(int8, int8) in
system,and they'd otherwise cause an<br />ambiguity failure for the query, use the plus(int4, int4) on mine. It<br
/>seemsnot too far from having the search path shadow later exact matches.<br /></pre></blockquote><pre wrap=""><br
/>Giventhe complexity of the resolution rules (cf.<br /><a class="moz-txt-link-freetext"
href="http://developer.postgresql.org/docs/postgres/typeconv.html">http://developer.postgresql.org/docs/postgres/typeconv.html</a>),<br
/>it'snot clear that we can determine exactly which "later" entry ought<br />to be blamed for causing a resolution
failure. I'd be interested to<br />hear Lockhart's opinion on this --- but my gut feeling is we don't<br />want to go
there. The resolution rules are already complicated enough,<br />and I think layering an additional mechanism like that
ontothem might<br />make the behavior totally unpredictable.<br /><br />Another problem is that this would probably
causeearlier namespace<br />entries to be over-preferred.  For example, suppose that the system<br />namespace has
plus(int4,int4)and plus(int8,int8) and you choose to<br />define plus(int4,int8) locally.  I believe you'd suddenly
findyours<br />being used for *any* cross-datatype addit
 
ion, including cases that<br />had nothing obvious to do with either int4 or int8 ...<br /></pre></blockquote> This is
agood example.  The other option is to use  name, arg1, arg2... as a hunt path for function call resolution.  This
woulddepend on when datatype promotion is occuring (i.e. int4 to int8, int8 to int4, etc... )<br /><br /> Then you
couldjust be really hard and say that only exact and trivial conversion matches in user space will be used .   <br
/><br/> There is no easy answer for this, but whatever rules are initiated need to be something that someone can step
throughto solve w/o a machine.<br /><br /> I do think you will ultimately need a search utility that provides 'which'
functionality.  (Given my namespace, which function in what namespace is going to be called.)<br /><blockquote
cite="mid:3159.1011804418@sss.pgh.pa.us"type="cite"><pre wrap=""><br /><br />            regards, tom lane<br /><br
/>---------------------------(endof broadcast)---------------------------<br />TIP 1: subscribe and unsubscribe
commandsgo to <a class="moz-txt-link-abbreviated"
href="mailto:majordomo@postgresql.org">majordomo@postgresql.org</a><br/></pre></blockquote><br /><br /> 

pgsql-hackers by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Add OR REPLACE clauses to non-FUNCTION object creation
Next
From: Bill Studenmund
Date:
Subject: Re: RFD: schemas and different kinds of Postgres objects