Re: Update HSTORE record and then delete if it is now empty - What is the correct sql? - Mailing list pgsql-sql

From Ashwin Jayaprakash
Subject Re: Update HSTORE record and then delete if it is now empty - What is the correct sql?
Date
Msg-id CAF9YjSA2GE2woG0e5FDN-Pd4Jd9vqrZgQdsFt4yx7Ud8EkJaRA@mail.gmail.com
Whole thread Raw
In response to Re: Update HSTORE record and then delete if it is now empty - What is the correct sql?  (Ian Lawrence Barwick <barwick@gmail.com>)
List pgsql-sql
Thanks, that makes sense.


On Fri, Feb 22, 2013 at 9:53 PM, Ian Lawrence Barwick <barwick@gmail.com> wrote:
2013/2/23 Ashwin Jayaprakash <ashwin.jayaprakash@gmail.com>:
(...)
>
> Q2: What the best way to check if an HSTORE is empty? Is this it
> "array_length(akeys(data), 1) is null"?

Just a quick answer to your second question: I suspect it might be more
efficient to check your HSTORE column against an empty HSTORE, e.g.

  WHERE val = ''::HSTORE

HTH

Ian Barwick

pgsql-sql by date:

Previous
From: Don Parris
Date:
Subject: Re: Summing & Grouping in a Hierarchical Structure
Next
From: Ashwin Jayaprakash
Date:
Subject: Re: Update HSTORE record and then delete if it is now empty - What is the correct sql?