can someone explain confusing array indexing nomenclature

From: chrisj <chrisj(dot)wood(at)sympatico(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: can someone explain confusing array indexing nomenclature
Date: 2007-02-14 19:31:38
Message-ID: 8971770.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


given the following table:

protocal2=> select * from sal_emp ;
name | pay_by_quarter | schedule
-------+---------------------------+-------------------------------------------
Bill | {10000,10000,10000,10000} |
{{meeting,lunch},{training,presentation}}
Carol | {20000,25000,25000,25000} |
{{breakfast,consulting},{meeting,lunch}}
(2 rows)

why do the following two queries yield different results??

protocal2=> SELECT schedule[1][2] FROM sal_emp WHERE name = 'Bill';
schedule
----------
lunch
(1 row)

protocal2=> SELECT schedule[1:1][2] FROM sal_emp WHERE name = 'Bill';
schedule
-------------------
{{meeting,lunch}}
(1 row)

--
View this message in context: http://www.nabble.com/can-someone-explain-confusing-array-indexing-nomenclature-tf3229165.html#a8971770
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Edward W. Rouse 2007-02-14 22:21:44 problem with join
Previous Message sahaanaa subha 2007-02-14 06:44:38 Regaring posting a query