Re: hstore ==> and deprecate =>

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: hstore ==> and deprecate =>
Дата
Msg-id F2551EB9-59B1-4481-A96E-28C5DFDE585E@kineticode.com
обсуждение исходный текст
Ответ на Re: hstore ==> and deprecate =>  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: hstore ==> and deprecate =>  (Florian Pflug <fgp@phlo.org>)
Список pgsql-hackers
On Jun 16, 2010, at 4:58 PM, Tom Lane wrote:

>> hstore => text[] is new in 9.0.
>
> Wup, sorry, I read this as being the other operator.  Nevermind ...
>
> (FWIW, I share your dislike of & for this operator.  I just haven't
> got a better idea.)

There aren't any very good choices. Possible correlates:
 text[] key_slice := my_hstore -> ARRAY['foo', 'bar'];
 bool has_keys := my_hstore ?& ARRAY['foo', 'bar'];
 text[] keyvals := %% my_hstore;
 text[] keyvals := %# my_hstore;

Frankly, %% and %# are closest, in a sense. But instead of an array, we want to get back an hstore. -> and ?& are
correlatesin that their RHSs are arrays. 

Possible operators to get a slice of the hstore:
 hstore slice := my_hstore +> ARRAY['foo', 'bar'];
 hstore slice := my_hstore #> ARRAY['foo', 'bar'];
 hstore slice := my_hstore &> ARRAY['foo', 'bar'];
 hstore slice := my_hstore !> ARRAY['foo', 'bar'];
 hstore slice := my_hstore *> ARRAY['foo', 'bar'];
 hstore slice := my_hstore %> ARRAY['foo', 'bar'];
 hstore slice := my_hstore @ ARRAY['foo', 'bar'];
 hstore slice := my_hstore % ARRAY['foo', 'bar'];
 hstore slice := my_hstore # ARRAY['foo', 'bar'];
 hstore slice := my_hstore & ARRAY['foo', 'bar'];
 hstore slice := my_hstore @# ARRAY['foo', 'bar'];

Maybe %> is good, in that it combines %% and ->, in a sense. Or #>, which kind of goes along with #=, which also
returnsan hstore. 

Anyway, the more I look at it the less I care, as long as *something* works.

Best,

David



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: streaming replication breaks horribly if master crashes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Keepalive for max_standby_delay