Hello,

I need some basic SQL help.  I added a new column to an existing table,
and now I need to copy values from one of the old columns to this new
columns.

I need something like this:

FOR pvId IN SELECT id FROM preference_value LOOP
        update preference_value SET display_value = (select value from
preference_value where id=pvId) where id=pvId;
END LOOP;

I tried running this from psql, but it didn't work (I suspect FOR can
be used in functions, which I don't know how to write in PG, yet).

Is there a simple way to do this?

Thanks,
Otis


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to