Re: Getting json-value as varchar

Поиск
Список
Период
Сортировка
От Andreas Joseph Krogh
Тема Re: Getting json-value as varchar
Дата
Msg-id VisenaEmail.39.5eee7254b64bd194.17e2f89cd27@tc7-visena
обсуждение исходный текст
Ответ на Re: Getting json-value as varchar  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Getting json-value as varchar
Список pgsql-general
På torsdag 06. januar 2022 kl. 14:13:40, skrev David G. Johnston <david.g.johnston@gmail.com>:
On Thursday, January 6, 2022, Andreas Joseph Krogh <andreas@visena.com> wrote:
 
 
I think you misread my message. What I want is for the subscript-version:
('{"key":"value"}'::jsonb)['key']
to return:
 
┌──────────┐
│ ?column? │
├──────────┤
│ value    │
└──────────┘


instead of 
 
┌─────────┐
│  jsonb  │
├─────────┤
│ "value" │
└─────────
 
 
 A given syntax/operator can only return one thing so what you want is fundamentally not possible.
 
That's not very helpful....
Apparently I'm after a solution which either casts this to varchar or a function that takes JSONB as argument and outputs the first field-value as varchar.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Вложения

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

Предыдущее
От: Andreas Joseph Krogh
Дата:
Сообщение: Sv: Recommended storage hardware
Следующее
От: Thomas Markus
Дата:
Сообщение: Re: Getting json-value as varchar