Possible to access value in RECORD without knowing column name? - Mailing list pgsql-sql

From Collin Peters
Subject Possible to access value in RECORD without knowing column name?
Date
Msg-id df01c91b0705021217j2fc03527pc06339c954ab5ffd@mail.gmail.com
Whole thread Raw
Responses Re: Possible to access value in RECORD without knowing column name?  (Richard Albright <ralbright@insiderscore.com>)
List pgsql-sql
In plpgsl, if I have a RECORD variable that is populated via some
dynamic SQL, is it possible to access the columns in that RECORD
object without knowing the column names?  I.e. Can I grab whatever
value is the 3rd column?

random_colname = 'foobar';
sql = 'SELECT col1, col2, ' || random_colname || ' FROM table';

FOR mviews IN EXECUTE sql LOOP  --possible to access 3rd column of mviews?  something like mviews[3]?
END LOOP;

Regards,
Collin


pgsql-sql by date:

Previous
From: "Collin Peters"
Date:
Subject: Re: Dynamic prepare possible in plpgsql?
Next
From: Richard Albright
Date:
Subject: Re: Possible to access value in RECORD without knowing column name?