Re: PATCH: Implement value_to_json for single-datum conversion

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: PATCH: Implement value_to_json for single-datum conversion
Дата
Msg-id 50287CF4.4040504@ringerc.id.au
обсуждение исходный текст
Ответ на Re: PATCH: Implement value_to_json for single-datum conversion  (Craig Ringer <ringerc@ringerc.id.au>)
Ответы Re: PATCH: Implement value_to_json for single-datum conversion
Список pgsql-hackers
OK, opr_sanity was failing because I added the value_to_json(text) alias
to ensure that:

   value_to_json('some_literal')

worked, following the same approach as quote_literal(anyelement) and
quote_literal(text). That should be reasonable, right? The comments on
the affected check in opr_sanity say that it's not necessarily wrong so
long as the called function is prepared to handle the different
arguments its self - which it is, since it's already accepting anyelement.

The test comment reads:

   Note that the expected output of this part of the test will
   need to be modified whenever new pairs of types are made
binary-equivalent,
   or when new polymorphic built-in functions are added

so that seems reasonable.


postgres=# \df quote_literal
                               List of functions
    Schema   |     Name      | Result data type | Argument data types |
Type
------------+---------------+------------------+---------------------+--------
  pg_catalog | quote_literal | text             | anyelement | normal
  pg_catalog | quote_literal | text             | text | normal
(2 rows)

postgres=# \df value_to_json
                               List of functions
    Schema   |     Name      | Result data type | Argument data types |
Type
------------+---------------+------------------+---------------------+--------
  pg_catalog | value_to_json | json             | anyelement | normal
  pg_catalog | value_to_json | json             | text | normal
(2 rows)

Revised patch that tweaks the expected result of opr_sanity attached.

--
Craig Ringer

Вложения

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: PL/Perl build problem: error:‘OP_SETSTATE’ undeclared
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PATCH: Implement value_to_json for single-datum conversion