| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
|---|---|
| To: | Han Holl <han(dot)holl(at)pobox(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Index on computed column |
| Date: | 2004-04-26 18:06:11 |
| Message-ID: | 20040426110455.T9774@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Tue, 20 Apr 2004, Han Holl wrote:
> Hi,
>
> Can anyone explain to me what I'm doing wrong:
> (The first select is to show that the function rubriek exists, and does work).
> I want to create an index on a computed column:
>
> palga=> select rubriek(rapport, lseek, 'naamvrouw',0) from main
> where rapport = 'T098-20900';
> rubriek
> -----------
> Ramrattan
> (1 row)
> palga=> create index nm_idx on main (rubriek(rapport, lseek, 'naamvrouw',0));
> ERROR: parser: parse error at or near "'naamvrouw'" at character 54
> palga=>
>
> This is postgresql-7.3.4-3.rhl9.
In 7.3, functional indexes can only be across columns of the table, so
something like the above is illegal. You can get around this my making a
function that hardcodes the constants and then use that in the index and
queries.
In 7.4, you can index a more general set of expressions.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | 2004-04-26 18:08:54 | pg_restore problem | |
| Previous Message | Bruno Wolff III | 2004-04-26 17:42:26 | Re: Arbitrary precision modulo operation |