Hello,
How do I load a column of data in postgres? For example, if I have a table and I add a new column via alter table that is an integer, (Say, if the current table has 1000 rows of data) and I want to add 1000 values to the new column. What's the best approach to doing this? I've looked at the Copy command but it doesn't seem (at least from the documentation I've read) allow copies into single columns. i've tried doing an update like this:
update table foo set column bar = (10,20,30,40,50) but that complains about setting an integer to type 'record', and requiring a cast.
Do I need to write a postgres stored procedure to somehow iterate over each row and add the column from a data source?
Thanks,
-- redmage123
How do I load a column of data in postgres? For example, if I have a table and I add a new column via alter table that is an integer, (Say, if the current table has 1000 rows of data) and I want to add 1000 values to the new column. What's the best approach to doing this? I've looked at the Copy command but it doesn't seem (at least from the documentation I've read) allow copies into single columns. i've tried doing an update like this:
update table foo set column bar = (10,20,30,40,50) but that complains about setting an integer to type 'record', and requiring a cast.
Do I need to write a postgres stored procedure to somehow iterate over each row and add the column from a data source?
Thanks,
-- redmage123