Syntax problem with INDEX on expression

From: Mike Blackwell <mike(dot)blackwell(at)rrd(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Syntax problem with INDEX on expression
Date: 2013-04-05 21:03:36
Message-ID: CANPAkguZ2MTqTNhkVwOrkdTxvdCsiY-1wmQkut__OfKS-2qJvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The following expression works fine in a query:

sp_dev=# select (xpath('//rms:xsid/text()',udh,array[array['rms','
http://www.example.com']]))[1]::text from test;
xpath
----------------------
0000000125846
0000000125843
0000000125844
0000000125842
0000000125845
0000000125847

(10 rows)

However, when the same expression doesn't seem to work for creating an
index:

sp_dev=# create index test_idx on test
((xpath('//rms:xsid/text()',udh,array[array['rms','http://www.example.com
']]))[1]::text);
ERROR: syntax error at or near "["
LINE 1: ...udh,array[array['rms','http://www.example.com']]))[1]::text)...
^

It looks like it doesn't like the array subscript. What might I be missing?

__________________________________________________________________________________
*Mike Blackwell | Technical Analyst, Distribution Services/Rollout
Management | RR Donnelley*
1750 Wallace Ave | St Charles, IL 60174-3401
Office: 630.313.7818
Mike(dot)Blackwell(at)rrd(dot)com
http://www.rrdonnelley.com

<http://www.rrdonnelley.com/>
* <Mike(dot)Blackwell(at)rrd(dot)com>*

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Grittner 2013-04-05 21:18:30 Re: Syntax problem with INDEX on expression
Previous Message Kevin Grittner 2013-04-05 20:21:22 Re: BEFORE UPDATE trigger doesn't change column value