postgresql - return select from view, update one column postgres -
i have view. want function returns rows view; however, need change 1 value in each of rows return.
i can using select , writing field names in select clause , listing values including 1 change, makes code obscure.
seems want light weight temporary table. want write like:
update { select * myview f(row,x,y) } set column = y
where x , y arguments function, column column name myview, , f function.
is there can write? thanks.
some pointers:
- you can view in have list columns separately:
create view myviewmodified select y column, ... myview;
, after can useselect * myviewmodified f(row,x,y);
- you write
select y column1modified, * myview;
in code , use column1modified. way can use asterisk-symbol. - listing values might make code obscure if drive code through poor sql can make quite clean (it helps if accustomed reading sql queries).
- why select * considered harmful?
Comments
Post a Comment