Derby
  1. Derby
  2. DERBY-4399

Syntax description for TableViewOrFunctionExpression lack subquery option

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.5.3.0
    • Fix Version/s: 10.6.1.0
    • Component/s: Documentation
    • Labels:
      None
    • Urgency:
      Normal

      Description

      In the reference manual, we find these syntax descriptions (start with http://db.apache.org/derby/docs/dev/ref/rrefsqlj21583.html):

      TableExpression:

      { TableViewOrFunctionExpression | JOIN operation }

      TableViewOrFunctionExpression:

      { table-Name | view-Name | TableFunctionInvocation}

      [ [ AS ] correlation-Name
      [ (Simple-column-Name [ , Simple-column-Name]* ) ] ] ]

      I cannot find a way from the "FROM clause" to the TableSubquery production, so I think the latter should read:

      { table-Name | TableSubquery | view-Name | TableFunctionInvocation }

      [ [ AS ] correlation-Name
      [ (Simple-column-Name [ , Simple-column-Name]* ) ] ] ]

      Also, the "JOIN operation" is not clickable.

      1. DERBY-4399.diff
        5 kB
        Kim Haase
      2. DERBY-4399-2.diff
        3 kB
        Kim Haase
      3. rrefsqlj33215.html
        3 kB
        Kim Haase
      4. rrefsqlj33215.html
        3 kB
        Kim Haase
      5. rreftableexpression.html
        6 kB
        Kim Haase
      6. rreftableexpression.html
        6 kB
        Kim Haase

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Isn't the correlation-Name required when you have a TableSubquery in a FROM clause? The suggested change will describe it as optional.

        Show
        Knut Anders Hatlen added a comment - Isn't the correlation-Name required when you have a TableSubquery in a FROM clause? The suggested change will describe it as optional.
        Hide
        Dag H. Wanvik added a comment -

        Good catch. Actually, this applies for TableFunctionInvocation and the undocumented "new <diagnotics VTI classname>()" syntax, too.

        Show
        Dag H. Wanvik added a comment - Good catch. Actually, this applies for TableFunctionInvocation and the undocumented "new <diagnotics VTI classname>()" syntax, too.
        Hide
        Dag H. Wanvik added a comment -

        Does this look right? I think it's more readable to factor out the correlation, e.g. as:

        TableViewOrFunctionExpression:

        {

        { table-Name | view-Name }

        [ Correlation ]

        { TableSubquery | TableFunctionInvocation }

        Correlation
        }

        Correlation:

        [ AS ]
        correlation-Name
        [ ( Simple-column-Name [ , Simple-column-Name ]* ) ]

        Show
        Dag H. Wanvik added a comment - Does this look right? I think it's more readable to factor out the correlation, e.g. as: TableViewOrFunctionExpression: { { table-Name | view-Name } [ Correlation ] { TableSubquery | TableFunctionInvocation } Correlation } Correlation: [ AS ] correlation-Name [ ( Simple-column-Name [ , Simple-column-Name ]* ) ]
        Hide
        Knut Anders Hatlen added a comment -

        Looks correct to me. Factoring out the correlation sounds like a good idea. Thanks!

        Show
        Knut Anders Hatlen added a comment - Looks correct to me. Factoring out the correlation sounds like a good idea. Thanks!
        Hide
        Kim Haase added a comment -

        I've been meaning to pick this up for weeks, so I thought I'd better start on it.

        I'm wondering if I should retitle the correlation-Name topic Correlation and rewrite it, or whether we need a new Correlation topic in between the TableViewOrFunctionExpression topic and the correlation-Name topic. Rewriting the correlation-Name topic might be simpler.

        TableViewOrFunctionExpression: http://db.apache.org/derby/docs/dev/ref/rrefsqlj33215.html
        correlation-Name: http://db.apache.org/derby/docs/dev/ref/rrefcorrelationname.html

        In either case I need a definition of the term "Correlation" – can you help me out, Dag or Knut? Thanks!

        Show
        Kim Haase added a comment - I've been meaning to pick this up for weeks, so I thought I'd better start on it. I'm wondering if I should retitle the correlation-Name topic Correlation and rewrite it, or whether we need a new Correlation topic in between the TableViewOrFunctionExpression topic and the correlation-Name topic. Rewriting the correlation-Name topic might be simpler. TableViewOrFunctionExpression: http://db.apache.org/derby/docs/dev/ref/rrefsqlj33215.html correlation-Name: http://db.apache.org/derby/docs/dev/ref/rrefcorrelationname.html In either case I need a definition of the term "Correlation" – can you help me out, Dag or Knut? Thanks!
        Hide
        Dag H. Wanvik added a comment -

        Thanks for picking this one up, Kim. I think it's ok to use the existing topic.
        I suggest renaming "correlation" to "correlation clause", and present the syntax in the (renamed) topic, but not give any specific definition to that term (a clause is a grammar entity); just keep the current explanation for correlation-name.

        Show
        Dag H. Wanvik added a comment - Thanks for picking this one up, Kim. I think it's ok to use the existing topic. I suggest renaming "correlation" to "correlation clause", and present the syntax in the (renamed) topic, but not give any specific definition to that term (a clause is a grammar entity); just keep the current explanation for correlation-name.
        Hide
        Kim Haase added a comment -

        Thanks, Dag! If we rename the topic, then maybe I should move it from its current location under "SQL identifiers" to under "SQL clauses"? But all the other clauses have introductory material. I'll post a patch without moving it and then we can think about it some more.

        Show
        Kim Haase added a comment - Thanks, Dag! If we rename the topic, then maybe I should move it from its current location under "SQL identifiers" to under "SQL clauses"? But all the other clauses have introductory material. I'll post a patch without moving it and then we can think about it some more.
        Hide
        Kim Haase added a comment -

        Uploading patch, and 2 HTML files (one more to come).

        M src/ref/rrefcorrelationname.dita
        M src/ref/rreftableexpression.dita
        M src/ref/rrefsqlj33215.dita

        Made some formatting fixes too. Hope they are not too much clutter.

        Show
        Kim Haase added a comment - Uploading patch, and 2 HTML files (one more to come). M src/ref/rrefcorrelationname.dita M src/ref/rreftableexpression.dita M src/ref/rrefsqlj33215.dita Made some formatting fixes too. Hope they are not too much clutter.
        Hide
        Kim Haase added a comment -

        Other HTML file.

        Show
        Kim Haase added a comment - Other HTML file.
        Hide
        Dag H. Wanvik added a comment -

        Thanks!
        The TableViewOrFunctionExpression should use the same term as the renamed topic (reference from TableViewOrFunctionExpression still uses plain "Correlation").

        If you don't like the Correlation clause topic having no introductory text, maybe you can just add the "Correlation clause" production to the topic for TableViewOrFunctionExpression and retain the separate topic for correlation-name? I'm OK with either solution.

        Perhaps we should also put "Correlation clause" into camel case: "CorrelationClause".

        Show
        Dag H. Wanvik added a comment - Thanks! The TableViewOrFunctionExpression should use the same term as the renamed topic (reference from TableViewOrFunctionExpression still uses plain "Correlation"). If you don't like the Correlation clause topic having no introductory text, maybe you can just add the "Correlation clause" production to the topic for TableViewOrFunctionExpression and retain the separate topic for correlation-name? I'm OK with either solution. Perhaps we should also put "Correlation clause" into camel case: "CorrelationClause".
        Hide
        Kim Haase added a comment -

        Thanks, Dag! I've adopted your suggestion of leaving the correlation-name topic as it was and adding the production to the revised TableViewOrFunctionExpression syntax topic. I'm attaching a new patch file with those changes only.

        M src/ref/rreftableexpression.dita
        M src/ref/rrefsqlj33215.dita

        Show
        Kim Haase added a comment - Thanks, Dag! I've adopted your suggestion of leaving the correlation-name topic as it was and adding the production to the revised TableViewOrFunctionExpression syntax topic. I'm attaching a new patch file with those changes only. M src/ref/rreftableexpression.dita M src/ref/rrefsqlj33215.dita
        Hide
        Kim Haase added a comment -

        The new patch is DERBY-4399-2.diff. To avoid confusion, I removed the correlation-name topic that was modified for the first patch.

        Show
        Kim Haase added a comment - The new patch is DERBY-4399 -2.diff. To avoid confusion, I removed the correlation-name topic that was modified for the first patch.
        Hide
        Dag H. Wanvik added a comment -

        +1 to commit.

        Show
        Dag H. Wanvik added a comment - +1 to commit.
        Hide
        Kim Haase added a comment -

        Thanks very much, Dag.

        Committed patch DERBY-4399-2.diff to documentation trunk at revision 882686.

        Show
        Kim Haase added a comment - Thanks very much, Dag. Committed patch DERBY-4399 -2.diff to documentation trunk at revision 882686.
        Hide
        Kim Haase added a comment -

        Fix appeared in online docs long ago, so closing.

        Show
        Kim Haase added a comment - Fix appeared in online docs long ago, so closing.

          People

          • Assignee:
            Kim Haase
            Reporter:
            Dag H. Wanvik
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development