title: Declare row type variable in PL/pgSQL
body: <p>As I found <code>SELECT * FROM t INTO my_data;</code> works only if:</p>
  
  <pre><code>DO $$
  DECLARE
  my_data t%ROWTYPE;
  BEGIN
  SELECT * FROM t INTO my_data WHERE id = ?;
  END $$;
  </code></pre>
  
  <p>Am I right?</p>
  
  <p>If I want to get only 2-3 columns instead of all columns. How can I define <code>my_data</code>?</p>
  
  <p>That is,</p>
  
  <pre><code>DO $$
  DECLARE
  my_data &lt;WHAT HERE??&gt;;
  BEGIN
  SELECT id,name,surname FROM t INTO my_data WHERE id = ?;
  END $$;
  </code></pre>