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

DELETE .. RETURNING does not always return metadata

    XMLWordPrintable

Details

    Description

      In some cases DELETE ... RETURNING which does not delete any rows does not return metadata. In other cases it does. Apparently it is not the expected behavior/

      create table t (a int);
      --enable_metadata
      delete from t returning *;
      delete from t where 0 returning *;
      delete from t where not exists (select * from mysql.user) returning *;
      select * from t where 0;
       
      # Cleanup
      --disable_metadata
      drop table t;
      

      10.3 162c1505

      delete from t returning *;
      Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
      def	test	t	t	a	a	3	11	0	Y	32768	0	63
      a
      delete from t where 0 returning *;
      delete from t where not exists (select * from mysql.user) returning *;
      select * from t where 0;
      Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
      def	test	t	t	a	a	3	11	0	Y	32768	0	63
      a
      

      So, DELETE without a WHERE clause returns metadata, even though the table is empty. But DELETE with an impossible condition does not.
      SELECT however returns metadata with the same impossible conditions.

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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