Re: Create index on array element?

From: Dave Bodenstab <dave_bodenstab(at)sbcglobal(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Create index on array element?
Date: 2006-12-01 00:42:32
Message-ID: ekntpp$7ir$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis wrote:
> On Wed, 2006-11-29 at 14:39 -0600, Dave Bodenstab wrote:
>
>>I guess one cannot create an index on an element of an array?
>>
>>test=> create table test ( ordinal int[] );
>>CREATE TABLE
>>test=> create unique index x1 on test ( ordinal[1] );
>>ERROR: syntax error at or near ")" at character 45
>>LINE 1: create unique index x1 on test ( ordinal[1] );
>> ^
>
>
> You need more parenthesis.
>
> test=> create unique index x1 on test ( ( ordinal[1] ) );
>
> The reason is because "ordinal[1]" is an expression, similar to "ordinal
> [1] + 5" which would also need parenthesis.
>
> Hope this helps,
> Jeff Davis

Excellent! I never considered that "ordinal[1]" was an expression.
Thanks.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message adurrant 2006-12-01 03:19:23 initdb problem on Windows XP Home
Previous Message Jim Nasby 2006-12-01 00:40:48 Re: [GENERAL] Allowing SYSDATE to Work