Closed TrurlMcByte closed 10 years ago
You can do similar things with json_object - it was written for just this purpose. See https://bitbucket.org/qooleot/json_object
I doubt we'll ever do hstore, because it's not a builtin type and almost certainly never will be, but we could do a json value I guess. It's not on my priority list, though, meaning either someone else will have to do it, or someone will have to pay me to do it, or you'll probably have to wait a long time.
in last 9.3 already exists function hstore_to_json(hstore) in default contribution
Yes, I know. I wrote it. But calling hstore_to_json(hstore(val)) is horribly inefficient. And it requires you to have the hstore extension installed, which many people do not.
On 11/25/2013 02:57 PM, Trurl McByte wrote:
in last 9.3 already exists function hstore_to_json(hstore) in default contribution
— Reply to this email directly or view it on GitHub https://github.com/pg-redis-fdw/redis_fdw/issues/4#issuecomment-29236134.
hstore long time was only one easy/lazy alternative for complicated data (was also xml, but...) And now hstore is supported solution "from the box" and it's very useful for mass/production. in any case json functionality still very limited (no any of "?&", "?|" operators) and my first example looks better as
select key,json_object(value) as val from redis0_hash1 where (json_object(value)->'var1')::text <> ''
but better it's will be like
-- hstore: CREATE FOREIGN TABLE redis0_hash1 (key text, value hstore)...
select key, value->'var1', value->'var2' as val from redis0_hash1 where value ? 'var1';
-- OR json: CREATE FOREIGN TABLE redis0_hash1 (key text, value json)...
select key, value->'var1', value->'var2' as val from redis0_hash1 where value->'var1'' <> '''
As I mentioned before we will not ever have direct support for hstore values, because that would make the module dependent on the hstore module which it is not now, and I am not going to do that. We could do json. If you want it you can a) do it yourself, b) pay someone else to do it or c) wait until someone else gets around to it.
On 11/25/2013 03:34 PM, Trurl McByte wrote:
hstore long time was only one easy/lazy alternative for complicated data (was also xml, but...) And now hstore is supported solution "from the box" and it's very useful for mass/production. in any case json functionality still very limited (no any of "?&", "?|" operators) and my first example looks better as
select key,json_object(value) as val from redis0_hash1 where (json_object(value)->'var1')::text <> '' but better it's will be like
-- hstore: CREATE FOREIGN TABLE redis0_hash1 (key text, value hstore)... select key, value->'var1', value->'var2' as val from redis0_hash1 where value ? 'var1'; -- OR json: CREATE FOREIGN TABLE redis0_hash1 (key text, value json)... select key, value->'var1', value->'var2' as val from redis0_hash1 where value->'var1'' <> ''' — Reply to this email directly or view it on GitHub https://github.com/pg-redis-fdw/redis_fdw/issues/4#issuecomment-29239348.
mmm.... I'm selecting "a", wrap up it to go. ) Check my question, I'm just want to known if it's planned already.
What part of "no" don't you understand?
This one: "We could do" Relax, I have same problems with my projects, anybody wants something strange, but I'm don't have time to do something usefulness to me.
just text[] is not useful for hashes, currently I do something like