Re: Functional index adding one - Mailing list pgsql-general

From Sam Mason
Subject Re: Functional index adding one
Date
Msg-id 20080703160031.GX2572@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to Re: Functional index adding one  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Thu, Jul 03, 2008 at 11:11:26AM -0400, Tom Lane wrote:
> Sam Mason <sam@samason.me.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Delete from Join
Next
From: Oleg Bartunov
Date:
Subject: Re: Full text index without accents