dimanche 10 avril 2016

Using PostgreSQL, how do I find all records that have the jsonb column filled out?

Let's say I have a jsonb column type called "data" for the table "recipes". I'm trying to find all records that have "data" filled out (i.e. "data" is not null or an empty bracket {}).

I know for hstore columns, using ruby, you can use a query like this to do so:

Recipe.where("data <> ''")

Is there an equivalent query for jsonb?

Aucun commentaire:

Enregistrer un commentaire