Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 7AB369FB693 for ; Wed, 2 May 2007 16:17:15 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 15826-10 for ; Wed, 2 May 2007 16:17:09 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.234]) by postgresql.org (Postfix) with ESMTP id F15D19FB5CD for ; Wed, 2 May 2007 16:17:11 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 70so250571wra for ; Wed, 02 May 2007 12:17:09 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=tt8M59npGHwhVqVl4RdFgxwP6+ClcFljsSbpNLmLS+ZlzHNHDYyL7qd9EQe9dAkiBEQNCVefNoiDveb1lDGF8G+qvoiAs+PMdQ/7N+1o+eBc3IcfAUNmW56jc9OKkuXEwbZWMvio1cHGGJOBOjOAs6W3HxeExRmxAjx5ts31N80= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=HiKey+oUr0MJBrBQr6ACf2Jw74+85dokbFuNUU2gMMFRwhVd8C3YeE/3CbwFZsE0tjCRIPK10NSdg4lN7fF2rUsjWxmAw7gWfqX5hIKCkHe7Q/niVm+URM8hugKW1F6IjVox2Xb+Z+kiXVeggqqABowiSZul02IYWJYKs2nmZj8= Received: by 10.114.76.1 with SMTP id y1mr320644waa.1178133428689; Wed, 02 May 2007 12:17:08 -0700 (PDT) Received: by 10.114.37.3 with HTTP; Wed, 2 May 2007 12:17:08 -0700 (PDT) Message-ID: Date: Wed, 2 May 2007 12:17:08 -0700 From: "Collin Peters" To: pgsql-sql@postgresql.org Subject: Possible to access value in RECORD without knowing column name? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/7 X-Sequence-Number: 28288 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