Re: [GENERAL] Pattern match against array elements?

2015-10-12 Thread Israel Brewster
---Israel BrewsterSystems Analyst IIRavn Alaska5245 Airport Industrial RdFairbanks, AK 99709(907) 450-7293---BEGIN:VCARD VERSION:3.0 N:Brewster;Israel;;; FN:Israel Brewster ORG:Frontier Flying Service;MIS TITLE

Re: [GENERAL] Pattern match against array elements?

2015-10-12 Thread Jeff Janes
On Mon, Oct 12, 2015 at 11:39 AM, Tom Lane wrote: > Jeff Janes writes: > > On Mon, Oct 12, 2015 at 10:58 AM, Israel Brewster > > > wrote: > >> My first thought was to do something like this: > >> > >> SELECT * FROM (SELECT lognum,array_agg(flightnum) as flightnums FROM > logs > >> GROUP BY logn

Re: [GENERAL] Pattern match against array elements?

2015-10-12 Thread Israel Brewster
On Oct 12, 2015, at 10:39 AM, Tom Lane wrote: > > Jeff Janes writes: >> On Mon, Oct 12, 2015 at 10:58 AM, Israel Brewster >> wrote: >>> My first thought was to do something like this: >>> >>> SELECT * FROM (SELECT lognum,array_agg(flightnum) as flightnums FROM logs >>> GROUP BY lognum) s1 WHER

Re: [GENERAL] Pattern match against array elements?

2015-10-12 Thread Israel Brewster
In the general case, that might work, however in my actually use case the inner SQL query (and underlying table structure) is rather more complicated, making it so I really want the WHERE clause in an outside query, as in my (non-functional) example. Just to clarify, the actual structure of the que

Re: [GENERAL] Pattern match against array elements?

2015-10-12 Thread Tom Lane
Jeff Janes writes: > On Mon, Oct 12, 2015 at 10:58 AM, Israel Brewster > wrote: >> My first thought was to do something like this: >> >> SELECT * FROM (SELECT lognum,array_agg(flightnum) as flightnums FROM logs >> GROUP BY lognum) s1 WHERE '8%' like ANY(flightnums); >> >> But while this doesn't

Re: [GENERAL] Pattern match against array elements?

2015-10-12 Thread Jeff Janes
On Mon, Oct 12, 2015 at 10:58 AM, Israel Brewster wrote: > Is there any way to do a pattern match against the elements of an array in > postgresql (9.4 if the version makes a difference)? I have a grouped query > that, among other things, returns an array of values, like: > > SELECT lognum, array

Re: [GENERAL] Pattern match against array elements?

2015-10-12 Thread dinesh kumar
On Mon, Oct 12, 2015 at 10:58 AM, Israel Brewster wrote: > Is there any way to do a pattern match against the elements of an array in > postgresql (9.4 if the version makes a difference)? I have a grouped query > that, among other things, returns an array of values, like: > > SELECT lognum, array

[GENERAL] Pattern match against array elements?

2015-10-12 Thread Israel Brewster
Is there any way to do a pattern match against the elements of an array in postgresql (9.4 if the version makes a difference)? I have a grouped query that, among other things, returns an array of values, like: SELECT lognum, array_agg(flightnum) as flightnums FROM logs GROUP BY lognum; Where th