Gabriel Fernandez <[EMAIL PROTECTED]> writes:
> Is it possible to create an index using a function(field) sintaxis ?

Yes, but *only* on a function of one or more raw fields.

> CREATE  INDEX "i1_cdu" on "cdu" using btree ( substr(cdu_code,1,1)
> "varchar_ops" );

This doesn't work because you have some constants floating around in the
mix.

In theory you can work around this by creating a custom function, say
firstchar(varchar), that does "substr(x,1,1)", and then writing

CREATE  INDEX "i1_cdu" on "cdu" using btree ( firstchar(cdu_code) );

It's kind of a pain though...

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to