access sub elements using any()

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: access sub elements using any()
Date: 2022-10-31 17:04:00
Message-ID: 5fb866d1-8d2f-5118-18e2-9bbf227cbf1a@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Given an array of arrays ( e.g. v = {{1,'a'},{2,'b'},{3,'c'},{2,'d'}} )
is it possible, in plain sql, to access the first element of the listed
arrays using the IN function?  Say I wanted just those with 2 as first
element.  "where 2 = any(v[1])" does not work and not sure it's
supported.   And I cannot craft a lhs to fussy-match each of the
elements in v.  Can this be done?

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Torsten Grust 2022-10-31 22:36:56 Re: access sub elements using any()
Previous Message Steve Midgley 2022-10-24 15:57:01 Re: select only 1 pair