Re: hstore ==> and deprecate =>

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: hstore ==> and deprecate =>
Дата
Msg-id 871vc9h03s.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: hstore ==> and deprecate =>  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: hstore ==> and deprecate =>  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> But actually, there's another issue here: hstore defines not oneTom> but three => operators:
Tom>     text => text        yields hstore (with 1 element)Tom>     text[] => text[]    yields hstore (with N
elements)Tom>    hstore => text[]    yields hstore (subset)
 
Tom> It's reasonable to say that the first two are bad design, butTom> I'm a bit less willing to say that the last one
is. What shallTom> we do with that?
 

I added the second two primarily by analogy with the first; following
the existing pattern seemed to be the way to go at the time.

If the first (text => text) operator hadn't already been present when I
started looking at it, I'd probably have stuck to hstore() for all
construction methods rather than defining an operator. Creating operators
that take only existing builtin types is obviously a namespace problem in
that multiple independent modules might get into trouble by choosing the
same operators. Perhaps this should be formalized as some sort of style
guideline for module authors?

I'm happy with deprecating the first two => in favour of hstore() if
that is in line with general opinion. The hstore => text[] slice could
be replaced by another operator name; the existing name comes from the
analogy that (hstore -> text[]) returns the list of values, whereas
(hstore => text[]) returns both the keys and values.

-- 
Andrew (irc:RhodiumToad)


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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: warning message in standby
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Exposing the Xact commit order to the user