This update to oils_cstore.c moves in the direction of supporting
table aliases in JSON queries (but we're not there yet).
We now maintain a stack to represent the top level query and any
subqueries nested within it. In each stack frame we store information
about the core class and any joined classes, including whatever aliases
are used for them. This stack enables us to look up the table
corresponding to a given alias.
Such searches now replace the old is_joined function for determining
whether a given class is in scope for a column in the SELECT or
ORDER BY clause.
In passing:
1. Rewrote the first few lines of searchJOIN() so that it wouldn't
be so convoluted.
2. We now detect attempts to do autojoins, or to join to the same
table multiple ways. These are the sorts of queries that need
table aliases to disambiguate the table references, The old code
would create invalid SQL and then let PostgreSQL complain about it,
Now we complain about it up front.
3. Corrected spelling errors in a couple of messages.
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13674
dcc99617-32d9-48b4-a31d-
7c20da2025e4