pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Szálka Tamás <rontombontom@freestart.hu>
To: pgsql-sql@postgresql.org
Subject: plpgsql - accessing fields of record type
Date: Sun, 26 Sep 2004 18:15:57 +0200
Message-ID: <4156EB3D.3070805@freestart.hu> (raw)

Hi!

I'd like to ask whether it is possible to access fields of record type 
variable in plpgsql in the following way:

I have a table with field named "XY_1", "XY_2", ... "XY_255".
I want to access the values in the table from a plpgsql function somehow 
in a loop with the iterative variable. Can I address the appropriate   
''XY_'' || loopvariable    field with the help of the loop variable?
If I can, what is the syntax of this? Sorry, I've read through the 
documentation, but haven't find any solution.

I have thought of an alternative solution: can plpgsql convert a record 
type into array? (Then I could address the field value with the nth 
element of the array)

Thanks for your help

tomasz



view thread (2+ messages)  latest in thread

Message-ID: <4156EB3D.3070805@freestart.hu>
Permalink:  ../4156EB3D.3070805@freestart.hu/
Also on:    postgresql.org/message-id/4156EB3D.3070805@freestart.hu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rontombontom@freestart.hu
  Subject: Re: plpgsql - accessing fields of record type
  In-Reply-To: <4156EB3D.3070805@freestart.hu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox