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

quote(NULL) returns incorrect result in view ('NU' instead of 'NULL')

Details

    Description

      Test:

      create view v1 as select quote(NULL);
      select * from v1;
      drop view v1;
      

      Actual result:

      NU
      

      Expected result:

      NULL
      

      Attachments

        Issue Links

          Activity

            It looks like some type processing mismatch:

            select quote(NULL);
            quote(NULL)
            NULL
            explain extended select quote(NULL);
            id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
            1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
            Warnings:
            Note	1003	select quote(NULL) AS `quote(NULL)`
            create view v1 as select quote(NULL);
            select * from v1;
            quote(NULL)
            NU
            show create view v1;
            View	Create View	character_set_client	collation_connection
            v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select quote(NULL) AS `quote(NULL)`	latin1	latin1_swedish_ci
            explain extended select * from v1;
            id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
            1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	100.00	
            2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
            Warnings:
            Note	1003	/* select#1 */ select 'NU' AS `quote(NULL)` from dual
            drop view v1;
            

            select quote(NULL);
            explain extended select quote(NULL);
            create view v1 as select quote(NULL);
            select * from v1;
            show create view v1;
            explain extended select * from v1;
            drop view v1;
            

            sanja Oleksandr Byelkin added a comment - It looks like some type processing mismatch: select quote(NULL); quote(NULL) NULL explain extended select quote(NULL); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select quote(NULL) AS `quote(NULL)` create view v1 as select quote(NULL); select * from v1; quote(NULL) NU show create view v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select quote(NULL) AS `quote(NULL)` latin1 latin1_swedish_ci explain extended select * from v1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select 'NU' AS `quote(NULL)` from dual drop view v1; select quote(NULL); explain extended select quote(NULL); create view v1 as select quote(NULL); select * from v1; show create view v1; explain extended select * from v1; drop view v1;

            I looks like metainformation is wrong, so save in field saves only NU from NULL

            sanja Oleksandr Byelkin added a comment - I looks like metainformation is wrong, so save in field saves only NU from NULL

            Probably duplicate of MDEV-29552 (but versions mismatch)

            sanja Oleksandr Byelkin added a comment - Probably duplicate of MDEV-29552 (but versions mismatch)

            People

              bar Alexander Barkov
              lstartseva Lena Startseva
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.