Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360896 - Update SQL Query Model to add lateral table query
Summary: Update SQL Query Model to add lateral table query
Status: RESOLVED FIXED
Alias: None
Product: Data Tools
Classification: Tools
Component: SQL Query Model (show other bugs)
Version: 1.9.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 1.9.2   Edit
Assignee: Brian Payton CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-13 18:37 EDT by Brian Payton CLA
Modified: 2011-11-23 13:25 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Payton CLA 2011-10-13 18:37:06 EDT
Need to update the SQL Query Model to add support for the "lateral derived table" SQL element.  In ISO SQL terms, it's a form of table reference.  Namely:

<table reference> ::=
    <table factor>
  | <joined table>

<table factor> ::=
    <table primary> 

<table primary> ::=
    <table or query name> ...
  | <derived table> ...
  | <lateral derived table> ...
    ...

<lateral derived table> ::=
  LATERAL <table subquery>

Here's an example:

  SELECT d.dept_name, e.emp_name
    FROM 
      dept d, 
      LATERAL ( SELECT emp_id, emp_name
        FROM emp
        WHERE emp_dept = d.dept_id ) e

The difference the LATERAL keyword makes is that the subquery definition following the LATERAL keyword is allowed to refer to tables defined ahead of it in the same FROM clause.  A regular subquery can only refer to tables defined at a higher level in the query.

So in this example the subquery "e" can refer to the dept table "d" in its definition where otherwise that would be an invalid reference.
Comment 2 Brian Payton CLA 2011-10-17 01:39:10 EDT
Marking as fixed...
Comment 3 Brian Payton CLA 2011-11-23 13:25:05 EST
Hmm, let me try that again...