title: How to update a Postgresql table using a composite type
body: <p>I am trying to update a table using a composite key, and can't figure out
  the syntax. I have a table defined as:</p>
  
  <pre><code>create schema test;
  create type test.ra_dec as (f1 double precision, f2 double precision);
  create table test.pos_vel(
        xp double precision,
        yp double precision,
        xv double precision,
        yv double precision
  );
  insert into test.pos_vel(xp,yp,xv,yv) values
         (1,2,5,10),
         (2,3,10,20),
         (3,4,20,40);
  </code></pre>
  
  <p>I can verify my define type works:</p>
  
  <pre><code>gsh=# select cast( (100,200) as test.ra_dec);
      row    
  -----------
   (100,200)
  (1 row)
  </code></pre>
  
  <p>But I can't figure out how to update my table.</p>
  
  <pre><code>gsh=# update test.pos_vel set (xv,yv) = (select cast( (100,200) as test.ra_dec));
  ERROR:  syntax error at or near "select"
  LINE 1: update test.pos_vel set (xv,yv) = (select cast( (100,200) as...
  </code></pre>
  
  <p>I know for this trival example I can do it without using a composite type, but for speed reasons I want to define a function in pl/python and have it return a composite type, so I need to figure out the proper syntax. </p>
  
  <p>Can anyone help please?</p>