Re: searching array - Mailing list pgsql-general

From Joe Conway
Subject Re: searching array
Date
Msg-id 435329ED.7010004@joeconway.com
Whole thread Raw
In response to searching array  (Matthew Peter <survivedsushi@yahoo.com>)
Responses Re: searching array  (Matthew Peter <survivedsushi@yahoo.com>)
List pgsql-general
Matthew Peter wrote:
> I was trying to search a array with a GTE to value and
> it doesn't work. Is this supported? Or am I missing
> something?
>
> SELECT * FROM sal_emp WHERE 10000 >= ALL (pay_by_quarter);

Works for me:

CREATE TABLE sal_emp (
  name text,
  pay_by_quarter integer[],
  schedule text[][]
);
CREATE TABLE

INSERT INTO sal_emp VALUES (
  'Bill',
  '{10000, 10000, 10000, 10000}',
  '{{"meeting", "lunch"}, {"training", "presentation"}}'
);
INSERT 164825 1

INSERT INTO sal_emp VALUES (
  'Carol',
  '{20000, 25000, 25000, 25000}',
  '{{"breakfast", "consulting"}, {"meeting", "lunch"}}'
);
INSERT 164826 1

SELECT * FROM sal_emp WHERE 10000 >= ALL (pay_by_quarter);
  name |      pay_by_quarter       |                 schedule
------+---------------------------+-------------------------------------------
  Bill | {10000,10000,10000,10000} |
{{meeting,lunch},{training,presentation}}
(1 row)

Care to provide some more info? What version of Postgres are you using,
what is the exact SQL that is failing, and what is the error message
you're getting?

Joe

pgsql-general by date:

Previous
From: CSN
Date:
Subject: Anybody using PostGIS?
Next
From: talenat
Date:
Subject: Collate problem