Re: auto-filling a field on insert
От | Roderick A. Anderson |
---|---|
Тема | Re: auto-filling a field on insert |
Дата | |
Msg-id | 4AE06F31.5080700@cyber-office.net обсуждение исходный текст |
Ответ на | Re: auto-filling a field on insert (semi-ambivalent <thefronny@gmail.com>) |
Список | pgsql-general |
semi-ambivalent wrote: > On Oct 21, 8:54 pm, da...@fetter.org (David Fetter) wrote: >> On Wed, Oct 21, 2009 at 07:17:44PM -0700, semi-ambivalent wrote: >>> If I have a table with fields A, B, C and D how could I do something >>> such that if I insert values in fields A, B and C field D would be >>> auto-filled with the value A||B||C? Just a pointer of where to begin >>> looking is fine. Triggers? Copy ... From? Table or field >>> definitions? >> Instead of populating your table with this extra information, create a >> VIEW with what you want in it. >> >> Cheers, >> David. >> -- >> David Fetter <da...@fetter.org>http://fetter.org/ >> Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter >> Skype: davidfetter XMPP: david.fet...@gmail.com >> >> Remember to vote! >> Consider donating to Postgres:http://www.postgresql.org/about/donate >> >> -- >> Sent via pgsql-general mailing list (pgsql-gene...@postgresql.org) >> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general > > At first blush that looks good but I need an index on that concatted > value and I don't seem to be able to index a field in a view. I'll > check the docs on views to see if I'm missing something. How about an index on the three "fields"? http://www.postgresql.org/docs/8.4/static/sql-createindex.html \\||/ Rod --
В списке pgsql-general по дате отправления: