Thread: each (hstore)

each (hstore)

From
Tarlika Elisabeth Schmitz
Date:
On Pavel's blog, I found this statement, which does just what I need:

select (each(hstore(foo))).* from foo;


Excuse the daft question, but could, please, you explain what ".*" does?

--

Best Regards,
Tarlika Elisabeth Schmitz

Re: each (hstore)

From
hubert depesz lubaczewski
Date:
On Tue, May 17, 2011 at 12:27:08PM +0100, Tarlika Elisabeth Schmitz wrote:
> On Pavel's blog, I found this statement, which does just what I need:
>
> select (each(hstore(foo))).* from foo;
>
>
> Excuse the daft question, but could, please, you explain what ".*" does?

each(hstore) is a function that returns set of records. each record can
have many fields.
when you have value which is record, you can add .* to get all columns
from it, separately. since each(hstore) is expression, and not column
name/alias - you need to wrap is in () before adding .*

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/