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

FOUND_ROWS() returns 1 if no statement has still been executed

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Not a Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      5.5

      Description

      Reading MySQL manual it's not clear what FOUND_ROWS() should return if no statement has been executed by the current session. However I think that 1 could be misleading.

      Enter password:
      Welcome to the MariaDB monitor. Commands end with ; or \g.
      Your MariaDB connection id is 2
      Server version: 5.5.25-MariaDB mariadb.org binary distribution

      This software comes with ABSOLUTELY NO WARRANTY. This is free software,
      and you are welcome to modify and redistribute it under the GPL v2 license

      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

      MariaDB [(none)]> select found_rows();
      --------------

      found_rows()

      --------------

      1

      --------------
      1 row in set (0.00 sec)

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment - - edited

            It's not quite true that no statement has been executed by the session; it's just that you didn't issue any statements, but the session did. If you turn on your general log, you'll see that there are several statements executed when you open a connection, last of them being
            select @@version_comment limit 1
            after that you issue found_rows() which, quite naturally, returns 1.
            It might be not obvious at the first glance, but creating workarounds and hacks specifically for the interactive client program could have been cumbersome and even more confusing.

            Show
            elenst Elena Stepanova added a comment - - edited It's not quite true that no statement has been executed by the session; it's just that you didn't issue any statements, but the session did. If you turn on your general log, you'll see that there are several statements executed when you open a connection, last of them being select @@version_comment limit 1 after that you issue found_rows() which, quite naturally, returns 1. It might be not obvious at the first glance, but creating workarounds and hacks specifically for the interactive client program could have been cumbersome and even more confusing.

              People

              • Assignee:
                Unassigned
                Reporter:
                f_razzoli Federico Razzoli
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: