Re: two field table: field1, field2, how to add a third one with the auto-generated value replace(field2,'channel','AAAA')?
От
Scott Marlowe
Тема
Re: two field table: field1, field2, how to add a third one
with the auto-generated value replace(field2,'channel','AAAA')?
Дата
Msg-id
dcc563d10912122003p217c20c1q35f9bbc710c6098a@mail.gmail.com
Ответ на
two field table: field1, field2, how to add a third one with the
auto-generated value replace(field2,'channel','AAAA')? (zxo102 ouyang)
Список
Дерево обсуждения
two field table: field1, field2, how to add a third one with the
auto-generated value replace(field2,'channel','AAAA')? zxo102 ouyang <zxo102@gmail.com>
Re: two field table: field1, field2, how to add a third one
with the auto-generated value replace(field2,'channel','AAAA')? Scott Marlowe <scott.marlowe@gmail.com>
On Sat, Dec 12, 2009 at 7:05 PM, zxo102 ouyang wrote: > Hi evreyone, > I have a table with two fields > > field1 field2 > 1 1channel > 2 2channel > 3 3channel > > Now I want to add the third one with the value > replace(field2,'channel','AAAA') like > > field1 field2 field3 > 1 1channel replace(field2,'channel','AAAA') > 2 2channel replace(field2,'channel','AAAA') > 3 3channel replace(field2,'channel','AAAA') > > The field3 must be done automatically after a user input data into field1 > and field2. > > Any ideas? Thanks a lot. So, where are you headed. Should the third field ALWAYS be field2 with channel replcaed by AAAA? Or could it change after you've set it at first to that? If it will always be the same as field2 with the replacement, then creating a simple updatable view with the third row always computed is a reasonable choice. If you just want it set on insert or update of field2, but then want it to be modifiable, then a trigger might be a good answer.
В списке pgsql-general по дате отправления
От: zxo102 ouyang
Дата: