I have the following in a plpgsql function:
DECLARE
rec RECORD;
BEGIN
FOR rec IN EXECUTE 'SELECT * FROM '||table[1]
LOOP
--use the results here
END LOOP;
How can I determine the actual field name and the field value for the record variable (rec) if I were to look in index 1 or 2 or 3 of the variable?
As you can see from the snippet of the function, the table that will be queried is dynamic and as such so are the names of the fields the rec variable will be returning.
Thank you,
Derrick