[SQL] Update HSTORE record and then delete if it is now empty - What is the correct sql?

2013-02-22 Thread Ashwin Jayaprakash
Hi, here's what I'm trying to do: - I have a table that has an HSTORE column - I would like to delete some key-vals from it - If after deleting key-vals, the HSTORE column is empty, I'd like to delete the entire row I have the sample SQL here and the DML I was trying out. I thought a CTE

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

2013-02-23 Thread Ashwin Jayaprakash
Thanks, that makes sense. On Fri, Feb 22, 2013 at 9:53 PM, Ian Lawrence Barwick wrote: > 2013/2/23 Ashwin Jayaprakash : > (...) > > > > Q2: What the best way to check if an HSTORE is empty? Is this it > > "array_length(akeys(data), 1) is null"? > > Just a

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

2013-02-23 Thread Ashwin Jayaprakash
Thanks Tom. I'll try it out soon.