Re: Functional index adding one

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Functional index adding one
Date: 2008-07-03 16:00:31
Message-ID: 20080703160031.GX2572@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jul 03, 2008 at 11:11:26AM -0400, Tom Lane wrote:
> Sam Mason <sam(at)samason(dot)me(dot)uk> writes:
> > Not entirely sure why, but it'll probably have
> > something to do with avoiding ambiguity in the grammar.
>
> Right. The problem is the Berkeley-era decision to put index opclasses
> into the syntax without any keyword or punctuation, viz
>
> create index ... on table (column_name [ opclass_name ]);
>
> So something like
>
> CREATE INDEX token_position_func ON token (a + b);
>
> is ambiguous: is the + an infix operator, or is it a postfix operator
> and the "b" is to be taken as an opclass name?

In this case it seems unambiguous, but in general I can see why.
Hysterical raisins cause all sorts of fun!

> We hacked around that by requiring parens around expressions. For
> backwards compatibility with other Berkeley-era syntax, there's
> a special exception that you can omit the parens when the expression is
> just a function call.

I'm tempted to say "how about putting another example in the page" but
it seems to document the issue quite well already.

I've never liked to putting comments into the interactive version of the
manual, mainly because they disappear with each major version, but how
about having the manual link to the wiki? At the moment, the wiki seems
somewhat isolated and I never seem to find myself using it. If there
were some nice trails in, maybe it would be used more; somewhere like:

http://wiki.postgresql.org/wiki/Manual/sql-createindex

I wouldn't worry about versioning, just let the authors of the pages
deal with versioning issues in ways appropriate to the subject. Or has
this idea been dismissed before?

Sam

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2008-07-03 16:03:49 Re: High inserting by syslog
Previous Message Oleg Bartunov 2008-07-03 15:58:56 Re: Full text index without accents