Обсуждение: Why is hstore_to_json_loose not like hstore_to_jsonb_loose?

Поиск
Список
Период
Сортировка

Why is hstore_to_json_loose not like hstore_to_jsonb_loose?

От
Tom Lane
Дата:
hstore_to_json_loose() contains a heuristic that says that an hstore value
that looks like a JSON number should be treated as a number (and hence not
quoted).  That logic has an oversight in it, as per bug #13906, but it's
straightforward to fix.

However, I noticed that hstore_to_jsonb_loose() has completely different
(and much uglier) code to make the identical decision.  Is there a good
reason for that?  It seems to have avoided the bug in IsValidJsonNumber,
but looking at it doesn't fill me with confidence that it has no other
bugs, and anyway it's not clear why these two functions should have
different edge-case behaviors about what is a number and what is not.
So I am very sorely tempted to replace hstore_to_jsonb_loose()'s heuristic
with IsValidJsonNumber().

Comments, objections?
        regards, tom lane