Function call order dependency

From: pgsql(at)mohawksoft(dot)com
To: pgsql-hackers(at)postgresql(dot)org
Subject: Function call order dependency
Date: 2008-09-03 12:24:08
Message-ID: 45362.71.232.149.185.1220444648.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Is there a knowable order in which functions are called within a query in
PostgreSQL?

For example I'll use the Oracle "contains" function, though this is not
exactly what I'm doing, it just illustrates the issue clearly.

select *, score(1) from mytable where contains(mytable.title, 'Winding
Road', 1) order by score(1);

The "contains" function does a match against mytable.title for the term
'Winding Road' and both returns and saves an integer score which may be
retrieved later using the "score(...)" function. The integer used as a
parameter in score(...) and contains(...) is an index to reference which
score you need as more than one contains(...) call may be used in single
query.

This sets up an interesting issue, how can one ensure that "contains()" is
called prior to any "score()" function on each row? Is this possible? Is
there a specific order on which you can count?

Would it be something like: "where" clause first, left to right, followed
by select terms, left to right, and lastly the "order by" clause?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andriy Bakay 2008-09-03 12:43:29 SSL problems
Previous Message Gregory Stark 2008-09-03 11:20:30 Re: Question regarding the database page layout.