Details

      Description

      This script works fine in Oracle (and PostgreSQL):

      DROP TABLE t1;
      CREATE TABLE t1 (c1 INT, c2 INT);
      INSERT INTO t1 VALUES (10,10);
      INSERT INTO t1 VALUES (20,20);
      UPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);
      SELECT * FROM t1;
      

      SQL> SELECT * FROM t1; 
       
      	C1	   C2
      ---------- ----------
      	10	   10
      	21	   20
      

      Notice, the table t1 is used twice in the UPDATE query, as a target and as a source.

      Under term of this tasks will allow to use the same table as a source and as a target in UPDATE statements in MariaDB.

      Currently its not allowed and returns this error:

      ERROR 1093 (HY000): Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: