Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7492

Dereferencing foreign keys / automating joins

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Fix Version/s: N/A
    • Component/s: Parser
    • Labels:
      None

      Description

      Suppose you've got a posts table with a uid foreign key into the users table.
      Wouldn't it be nice if you could say
      select *, uid->name, uid->avatar from posts
      instead of
      select p.*, u.name, u.avatar from posts p left join users u using (uid) ?

      It'd save typing a lot of joins and significantly simplifies writing and reading queries.

      Note the syntax isn't the important part, I simply used the C way of dereferencing a pointer.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            XTF Olaf van der Spek added a comment -

            Since t1.a is not a foreign key it can't be dereferenced with this proposed feature.

            Show
            XTF Olaf van der Spek added a comment - Since t1.a is not a foreign key it can't be dereferenced with this proposed feature.
            Hide
            jplindst Jan Lindström added a comment -

            Sorry, bug on select, t2.b is a foreign key.

            Show
            jplindst Jan Lindström added a comment - Sorry, bug on select, t2.b is a foreign key.
            Hide
            XTF Olaf van der Spek added a comment -

            Didn't know that was legal. So, only allow dereferencing for single / deterministic references.

            Show
            XTF Olaf van der Spek added a comment - Didn't know that was legal. So, only allow dereferencing for single / deterministic references.
            Hide
            XTF Olaf van der Spek added a comment -

            So could you reopen this?

            Show
            XTF Olaf van der Spek added a comment - So could you reopen this?
            Hide
            jplindst Jan Lindström added a comment -

            Sorry, I really do not see enough reason to implement what you are suggesting.

            Show
            jplindst Jan Lindström added a comment - Sorry, I really do not see enough reason to implement what you are suggesting.

              People

              • Assignee:
                jplindst Jan Lindström
                Reporter:
                XTF Olaf van der Spek
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: