[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [GENERAL] Create index on array element?
From:       Jeff Davis <pgsql () j-davis ! com>
Date:       2006-11-30 23:26:21
Message-ID: 1164929181.7773.142.camel () dogma ! v10 ! wvs
[Download RAW message or body]

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


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic