Re: Variable column name

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
Cc: "Postgresql" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Variable column name
Date: 2011-09-01 14:59:35
Message-ID: 20110901105935.da14dcf6.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In response to "Bob Pawley" <rjpawley(at)shaw(dot)ca>:
>
> I want to add information to multiple columns (20 – 40) by employing a loop. Each pass of the loop will populate one column with an array.
>
> I have tried and I have read that variables can not be used to control column names.
>
> Is there a means of working around this restriction other than creating 20 to 40 hard coded statements??

You can generate dynamic SQL statements with plpgsql.

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bob Pawley 2011-09-01 15:04:49 Re: Variable column name
Previous Message Bob Pawley 2011-09-01 14:51:18 Variable column name