Re: PATCH: Implement value_to_json for single-datum conversion
| От | Tom Lane |
|---|---|
| Тема | Re: PATCH: Implement value_to_json for single-datum conversion |
| Дата | |
| Msg-id | 21714.1344832380@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: PATCH: Implement value_to_json for single-datum conversion (Craig Ringer <ringerc@ringerc.id.au>) |
| Список | pgsql-hackers |
Craig Ringer <ringerc@ringerc.id.au> writes:
> 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?
No, it isn't. What you're proposing is to let opr_sanity think that
text and anyelement are interchangeable to C functions, which is so
far from reality as to be ludicrous. That would be seriously damaging
to its ability to detect errors.
But more to the point, your analogy to quote_literal is faulty anyway.
If you looked at that, what you'd find is that only quote_literal(text)
is a C function. The other one is a SQL wrapper around a coercion to
text followed by the C function. I rather imagine that the definition
as you have it would crash on, say, value_to_json(42).
regards, tom lane
В списке pgsql-hackers по дате отправления: