From: | Dimitri Fontaine <dfontaine(at)hi-media(dot)com> |
---|---|
To: | Josh Berkus <josh(at)agliodbs(dot)com> |
Cc: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: hstore improvements? |
Date: | 2009-03-19 21:40:31 |
Message-ID: | 59900223-9304-448B-8130-1D9B9C5A831A@hi-media.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Le 19 mars 09 à 21:23, Josh Berkus a écrit :
>> One request I've had is to construct a record (of some supplied
>> composite type) from an hstore.
>>
>> I'm not sure if this is even possible; I'm certainly not seeing a way
>> to implement it. Am I missing something?
>
> Well, presumably you'd try to match hstore tags against the
> "columns" of the composite type, and where a tag didn't exist,
> return NULL,and where one isn't in the composite type, ignore it.
> All data would be TEXT.
The problem is more how to have the parser know which data type to
target, because you want to avoid having to create a new cast per each
composite type you want to target.
A solution could maybe look like this:
SELECT hstore_to_composite(hstore_value, null::my_composite_type);
Regards,
--
dim
from the IRC-to-List bridge dept ;)
From | Date | Subject | |
---|---|---|---|
Next Message | Gokulakannan Somasundaram | 2009-03-20 06:46:42 | Re: Extension of Thick Indexes |
Previous Message | Andrew Dunstan | 2009-03-19 21:32:37 | Re: pg_restore --multi-thread |