Re: auto-filling a field on insert

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: semi-ambivalent <thefronny(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: auto-filling a field on insert
Date: 2009-10-23 11:10:09
Message-ID: 4AE18F11.2060809@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

semi-ambivalent wrote:

> 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.

As others have noted, a multi-field index or a functional index is
probably the best option.

If you decide for some reason that you really, really need the
concatenated fields stored in the table its self, you will need to use a
BEFORE INSERT ... FOR EACH ROW trigger to populate field `D'.

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2009-10-23 11:18:46 Re: leak in libpq, getpwuid
Previous Message Craig Ringer 2009-10-23 11:07:53 Re: FATAL error could not find function "alt_to_mic" in file cyrillic_and_mic.so