How to select rows for which column has empty array ?

From: Arup Rakshit <aruprakshit(at)rocketmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: How to select rows for which column has empty array ?
Date: 2014-06-06 14:30:16
Message-ID: 1402065016.38538.YahooMailNeo@web193903.mail.sg3.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a below table :

yelloday_development=# select id,workplace_ids,team_ids  from reporting_groups ;                                                                                                                                                                                     
 id | workplace_ids | team_ids 
----+---------------+----------
  2 | {}            | {}
  3 | {}            | {}
  1 | {}            | {}
  4 | {1}           | {1}
  5 | {2}           | {2,3,4}
(5 rows)

yelloday_development=# select id from reporting_groups where 2 = ANY (team_ids)
yelloday_development-# ;
 id 
----
  5
(1 row)

How would I select rows which has empty array for the field "team_ids" ?
 
Regards,
Arup Rakshit

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-06-06 14:30:56 Re: interpret bytea output as text / double encode()
Previous Message Adrian Klaver 2014-06-06 14:16:15 Re: Postgresql service stopped automatically after restart