Re: Variable column name - Mailing list pgsql-general

From Bill Moran
Subject Re: Variable column name
Date
Msg-id 20110901105935.da14dcf6.wmoran@potentialtech.com
Whole thread Raw
In response to Variable column name  ("Bob Pawley" <rjpawley@shaw.ca>)
Responses Re: Variable column name  ("Bob Pawley" <rjpawley@shaw.ca>)
List pgsql-general
In response to "Bob Pawley" <rjpawley@shaw.ca>:
>
> I want to add information to multiple columns (20 – 40) by employing a loop. Each pass of the loop will populate one
columnwith 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/

pgsql-general by date:

Previous
From: "Bob Pawley"
Date:
Subject: Variable column name
Next
From: "Bob Pawley"
Date:
Subject: Re: Variable column name