pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chrisj <chrisj.wood@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: can someone explain confusing array indexing nomenclature
Date: Wed, 14 Feb 2007 11:31:38 -0800 (PST)
Message-ID: <8971770.post@talk.nabble.com> (raw)


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#a8971...
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.




view thread (8+ messages)  latest in thread

Message-ID: <8971770.post@talk.nabble.com>
Permalink:  ../8971770.post@talk.nabble.com/
Also on:    postgresql.org/message-id/8971770.post@talk.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: chrisj.wood@sympatico.ca
  Subject: Re: can someone explain confusing array indexing nomenclature
  In-Reply-To: <8971770.post@talk.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox