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

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Ashwin Jayaprakash <ashwin(dot)jayaprakash(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Update HSTORE record and then delete if it is now empty - What is the correct sql?
Date: 2013-02-23 05:53:15
Message-ID: CAB8KJ=iO7V5n4bPRJqec1UL84B7ofs_cd_+DjHibEbpa4jUt9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2013/2/23 Ashwin Jayaprakash <ashwin(dot)jayaprakash(at)gmail(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2013-02-23 10:49:41 Re: Update HSTORE record and then delete if it is now empty - What is the correct sql?
Previous Message Bryan L Nuse 2013-02-23 04:54:05 Re: Summing & Grouping in a Hierarchical Structure