title: Postgres could not determine data type of parameter $1 in Golang application
body: <p>I am creating an application in Golang that uses Postgres using the pq driver. I want to make a function that can select a user-determined field from my database, but I get an error:</p>
  
  <blockquote>
    <p>pq: could not determine data type of parameter $1</p>
  </blockquote>
  
  <p>Below is the code that generated this error:</p>
  
  <pre><code>var ifc interface{}
  
  if err := conn.QueryRow("SELECT $1 FROM "+db+" WHERE uuid=$3 OR uri=$4 LIMIT 1", field, UUIDOrURI, UUIDOrURI).Scan(&amp;ifc); err != nil {
      if err == sql.ErrNoRows {
          return http.StatusNotFound
      }
  
      log.Println(err)
  
      return http.StatusInternalServerError
  }
  </code></pre>
  
  <p>Why can I not insert the field that I want to  <code>SELECT</code> using <code>$1</code>? Is there another way to do this?</p>