title: MySQL - Why does a select statement on an indexed column return the index information, and not the column data?
body: <p>I have a table (InnoDB) that stores an activity log. Each row has a user id, an activity id, and location data. The user id and the activity id columns are indexed, though not unique. </p>
  
  <p>When I query <code>select *</code> the data returned looks normal - </p>
  
  <pre><code>select * from table
  </code></pre>
  
  <p>When I query user id or activity id with another column (even those 2 together), the data looks normal.</p>
  
  <pre><code>select user_id, city from table
  </code></pre>
  
  <p>When I query for just the user id or activity id with a where statement, the data looks normal.</p>
  
  <pre><code>select user_id from table where city = 'boulder'
  </code></pre>
  
  <p>The issue arises when I query for just the user id or activity id alone, or query just one with a where statement on the same column with a substring query.</p>
  
  <pre><code>select user_id from table
  </code></pre>
  
  <p>or</p>
  
  <pre><code>select user_id from table where substring(user_id, 1,5) = '12345'
  </code></pre>
  
  <p>The data returned is not the data in the field, but what looks like the index location (or something similar). I dropped the indexes, and the problem was fixed, but reappeared as soon as I added the indexes back.</p>
  
  <p>Example without index - </p>
  
  <pre><code>user_id   
  -------
  123456789
  231234567
  234567543
  </code></pre>
  
  <p>Example with index - </p>
  
  <pre><code>user_id
  -------
  081357652234
  100000000000000
  1000000000011
  </code></pre>
  
  <p>I've tried restarting the server, and then reloading the data from the api, but nothing helped. I've tested this on other tables in the same database without experiencing this problem.</p>
  
  <p>Is this a bug or some mistake I made in configuration?</p>