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

INSERT RETURNING

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • N/A
    • OTHER
    • None

    Description

      Dear Developers,

      Would make sense after getting any default possible value in columns to have INSERT RETURNING syntax , that send back resultset off every columns that do set a default value in a ROW.

      In useful in such cases :

      • to get back an array of auto increment PK values for connectors batch mode
      • to enable ORM to have a real object view of some default values inserted inside records
      • in multi master and Galera to stop using auto-increment for PK in profit of uuid_short
      • to pack protocol roundtrip like last_insert_id

      Oracle allow sequence for this:
      https://oracle-base.com/articles/misc/dml-returning-into-clause
      postgresql
      https://www.postgresql.org/docs/9.2/static/sql-insert.html

      MsSQL works for every default like UID
      INSERT INTO table (name)
      OUTPUT Inserted.ID
      VALUES('bob');

      SqlLite
      https://github.com/jazzyb/sqlite_ecto/wiki/Sqlite.Ecto's-Pseudo-Returning-Clause

      Thanks in advance

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              stephane@skysql.com VAROQUI Stephane
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.