Details

    Description

      Please add a RETURNING option to INSERT.

      Example from PostgreSQL

      postgres=# CREATE TABLE t1 (id SERIAL, name VARCHAR(100));
      CREATE TABLE
      postgres=# INSERT INTO t1(name) VALUES('test') RETURNING id;
       id 
      ----
        1
      (1 row)
       
      INSERT 0 1
      

      Inspired by: https://evertpot.com/writing-sql-for-postgres-mysql-sqlite/

      This could make it easier to write statements which work with both MariaDB and PostgreSQL. And this might improve compatibility with Oracle RDBMS.


      How it'll work:

      • All variants of INSERT will work — INSERT ... VALUES, INSERT ... SET, INSERT ... SELECT
      • INSERT ... ON DUPLICATE KEY UPDATE will work, will return the final row values (inserted or updated)
      • REPLACE will return what's inserted
      • INSERT IGNORE will return what it'll try to insert, (ignoring insert errors, as expected)
      • INSERT DELAYED will, obviously, not work
      • rows will be returned as they're being inserted. If the insert fails in the middle and is rolled back — rows might've been sent that didn't end up in the table

      Attachments

        Issue Links

          Activity

            dveeden Daniël van Eeden created issue -
            stephane@skysql.com VAROQUI Stephane made changes -
            Field Original Value New Value
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Priority Minor [ 4 ] Major [ 3 ]
            serg Sergei Golubchik made changes -
            Labels gsoc19
            serg Sergei Golubchik made changes -
            Labels gsoc19
            serg Sergei Golubchik made changes -
            Labels gsoc19
            serg Sergei Golubchik made changes -
            Assignee Oleksandr Byelkin [ sanja ]
            cvicentiu Vicențiu Ciorbaru made changes -
            serg Sergei Golubchik made changes -
            Assignee Oleksandr Byelkin [ sanja ] Sergei Golubchik [ serg ]
            serg Sergei Golubchik made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            serg Sergei Golubchik made changes -
            Status In Progress [ 3 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Status Stalled [ 10000 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Description (set as 'Data Manipulation - Insert Delayed', because I couldn't find a component for 'regular' insert)

            Please add a RETURNING option to INSERT.

            Example from PostgreSQL
            {noformat}
            postgres=# CREATE TABLE t1 (id SERIAL, name VARCHAR(100));
            CREATE TABLE
            postgres=# INSERT INTO t1(name) VALUES('test') RETURNING id;
             id
            ----
              1
            (1 row)

            INSERT 0 1
            {noformat}

            Inspired by: https://evertpot.com/writing-sql-for-postgres-mysql-sqlite/

            This could make it easier to write statements which work with both MariaDB *and* PostgreSQL. And this might improve compatibility with Oracle RDBMS.
            Please add a RETURNING option to INSERT.

            Example from PostgreSQL
            {noformat}
            postgres=# CREATE TABLE t1 (id SERIAL, name VARCHAR(100));
            CREATE TABLE
            postgres=# INSERT INTO t1(name) VALUES('test') RETURNING id;
             id
            ----
              1
            (1 row)

            INSERT 0 1
            {noformat}

            Inspired by: https://evertpot.com/writing-sql-for-postgres-mysql-sqlite/

            This could make it easier to write statements which work with both MariaDB *and* PostgreSQL. And this might improve compatibility with Oracle RDBMS.

            ----

            How it'll work:

            * All variants of {{INSERT}} will work — {{INSERT ... VALUES}}, {{INSERT ... SET}}, {{INSERT ... SELECT}}
            * {{INSERT ... ON DUPLICATE KEY UPDATE}} will work, will return the final row values (inserted or updated)
            * {{REPLACE}} will return what's inserted
            * {{INSERT IGNORE}} will return what it'll try to insert, (ignoring insert errors, as expected)
            * {{INSERT DELAYED}} will, obviously, not work
            serg Sergei Golubchik made changes -
            Description Please add a RETURNING option to INSERT.

            Example from PostgreSQL
            {noformat}
            postgres=# CREATE TABLE t1 (id SERIAL, name VARCHAR(100));
            CREATE TABLE
            postgres=# INSERT INTO t1(name) VALUES('test') RETURNING id;
             id
            ----
              1
            (1 row)

            INSERT 0 1
            {noformat}

            Inspired by: https://evertpot.com/writing-sql-for-postgres-mysql-sqlite/

            This could make it easier to write statements which work with both MariaDB *and* PostgreSQL. And this might improve compatibility with Oracle RDBMS.

            ----

            How it'll work:

            * All variants of {{INSERT}} will work — {{INSERT ... VALUES}}, {{INSERT ... SET}}, {{INSERT ... SELECT}}
            * {{INSERT ... ON DUPLICATE KEY UPDATE}} will work, will return the final row values (inserted or updated)
            * {{REPLACE}} will return what's inserted
            * {{INSERT IGNORE}} will return what it'll try to insert, (ignoring insert errors, as expected)
            * {{INSERT DELAYED}} will, obviously, not work
            Please add a RETURNING option to INSERT.

            Example from PostgreSQL
            {noformat}
            postgres=# CREATE TABLE t1 (id SERIAL, name VARCHAR(100));
            CREATE TABLE
            postgres=# INSERT INTO t1(name) VALUES('test') RETURNING id;
             id
            ----
              1
            (1 row)

            INSERT 0 1
            {noformat}

            Inspired by: https://evertpot.com/writing-sql-for-postgres-mysql-sqlite/

            This could make it easier to write statements which work with both MariaDB *and* PostgreSQL. And this might improve compatibility with Oracle RDBMS.

            ----

            How it'll work:

            * All variants of {{INSERT}} will work — {{INSERT ... VALUES}}, {{INSERT ... SET}}, {{INSERT ... SELECT}}
            * {{INSERT ... ON DUPLICATE KEY UPDATE}} will work, will return the final row values (inserted or updated)
            * {{REPLACE}} will return what's inserted
            * {{INSERT IGNORE}} will return what it'll try to insert, (ignoring insert errors, as expected)
            * {{INSERT DELAYED}} will, obviously, not work
            * rows will be returned as they're being inserted. If the insert fails in the middle and is rolled back — rows might've been sent that didn't end up in the table
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Vicentiu Ciorbaru [ cvicentiu ]
            serg Sergei Golubchik made changes -
            Assignee Vicențiu Ciorbaru [ cvicentiu ] Oleksandr Byelkin [ sanja ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.5 [ 23123 ]
            sanja Oleksandr Byelkin made changes -
            Assignee Oleksandr Byelkin [ sanja ] Sergei Golubchik [ serg ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.5.0 [ 23709 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 75500 ] MariaDB v4 [ 132861 ]
            danblack Daniel Black made changes -
            serg Sergei Golubchik made changes -
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            bar Alexander Barkov made changes -
            Issue Type Task [ 3 ] New Feature [ 2 ]

            People

              serg Sergei Golubchik
              dveeden Daniël van Eeden
              Votes:
              5 Vote for this issue
              Watchers:
              12 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.