title: The column name ... was not found in this ResultSet
body: <p>We are using java jdk 1.7.0_45, postgresql jdbc connector postgresql-9.3-1100.jdbc41.jar.</p>
  
  <p>Here is a synopsis of our problem, as much as possible of code pasted below.</p>
  
  <p>This code: 
      <pre>
          ResultSet rs = DbConn.getInstance().doQuery("Select d.deptId from Depts d");
                  while (rs.next()){
                      System.out.println(rs.getInt("d.deptId"));
      </pre>
      Produces the error:
      <pre>
      org.postgresql.util.PSQLException: The column name d.deptId was not found in this ResultSet.
      </pre></p>
  
  <p>This code:
      <pre>
                          ResultSet rs = DbConn.getInstance().doQuery("Select d.deptId from Depts d");
                  while (rs.next()){
                      System.out.println(rs.getInt("deptId"));
      </pre>
      Produces no error.</p>
  
  <p>Is there a way, besides removing the "d." from the first query, to make the first code snippet <i>not</i> throw the error message?</p>
  
  <p>Here is the source code:</p>
  
  <pre><code>public class JoinTest {
      @Test
      public void test(){
          boolean pass = false;
          try {
              ResultSet rs = DbConn.getInstance().doQuery("Select d.deptId from Depts d");
              String label = rs.getMetaData().getColumnLabel(1);  // What do you get?
              System.out.println("label = " + label);
              while (rs.next()){
                  System.out.println(rs.getInt("d.deptId"));
                  pass = true;
              }
          } catch (SQLException e) {
              e.printStackTrace();
              pass=false;
          }
          assertTrue(pass);
      }
      @Test
      public void test2(){
          boolean pass = false;
          try {
              ResultSet rs = DbConn.getInstance().doQuery("Select d.deptId from Depts d");
              while (rs.next()){
                  System.out.println(rs.getInt("deptId"));
                  pass = true;
              }
          } catch (SQLException e) {
              e.printStackTrace();
              pass=false;
          }
          assertTrue(pass);
      }
  }
  
      public class DbConn {
  
  
      private static String url = "jdbc:postgresql://server:port/schema";
          private static Properties props = new Properties(); {
              props.setProperty("user","userid");
              props.setProperty("password","passwprd");
          }
          private  Connection conn;
  
          private DbConn(){}
          private static DbConn instance;
          public static DbConn getInstance() throws SQLException{
              if (instance == null){
                  instance = new DbConn();
                  instance.conn = DriverManager.getConnection(url, props);
              }
              return instance;
          }
          public ResultSet doQuery(String query) throws SQLException{
              Logger.log("DbConn.doQuery: " + query);
              Statement st = conn.createStatement();
                  ResultSet rs = st.executeQuery(query);
                  return rs;
          }
          }
  
  }
  </code></pre>