Re: Getting json-value as varchar

2022-01-06 Thread Thomas Kellerer
Andreas Joseph Krogh schrieb am 06.01.2022 um 13:28: Hi, in PG-14 this query returns "value" (with double-quotes): SELECT ('{"key":"value"}'::jsonb)['key']; ┌─┐ │  jsonb  │ ├─┤ │ "value" │ └─┘ (1 row) and this returns 'value' (without the quotes): SELECT

Re: Getting json-value as varchar

2022-01-06 Thread Andreas Joseph Krogh
På torsdag 06. januar 2022 kl. 14:42:21, skrev Pavel Stehule < pavel.steh...@gmail.com >: Hi čt 6. 1. 2022 v 14:33 odesílatel Andreas Joseph Krogh mailto:andr...@visena.com>> napsal: På torsdag 06. januar 2022 kl. 14:29:12, skrev David G. Johnston <

Re: Getting json-value as varchar

2022-01-06 Thread Pavel Stehule
Hi čt 6. 1. 2022 v 14:33 odesílatel Andreas Joseph Krogh napsal: > På torsdag 06. januar 2022 kl. 14:29:12, skrev David G. Johnston < > david.g.johns...@gmail.com>: > > [..] > The fact is that the ‘ - - > ‘ operator gives you the needed output. > > David J. > > > Yeah, I think that's the

Re: Getting json-value as varchar

2022-01-06 Thread Andreas Joseph Krogh
På torsdag 06. januar 2022 kl. 14:29:12, skrev David G. Johnston < david.g.johns...@gmail.com >: [..] The fact is that the ‘ - - > ‘ operator gives you the needed output. David J. Yeah, I think that's the correct answer for this use-case. -- Andreas

Re: Getting json-value as varchar

2022-01-06 Thread David G. Johnston
On Thursday, January 6, 2022, Andreas Joseph Krogh wrote: > > 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. > > You can try casting the value though IIRC it doesn’t actually work

Re: Getting json-value as varchar

2022-01-06 Thread Thomas Markus
Hi, Am 06.01.22 um 13:36 schrieb Andreas Joseph Krogh: På torsdag 06. januar 2022 kl. 13:31:19, skrev Thomas Markus : Hi, Am 06.01.22 um 13:28 schrieb Andreas Joseph Krogh: Hi, in PG-14 this query returns "value" (with double-quotes): SELECT ('{"key":"value"}'::jsonb)['key'];

Re: Getting json-value as varchar

2022-01-06 Thread Andreas Joseph Krogh
På torsdag 06. januar 2022 kl. 14:13:40, skrev David G. Johnston < david.g.johns...@gmail.com >: On Thursday, January 6, 2022, Andreas Joseph Krogh mailto:andr...@visena.com>> wrote: I think you misread my message. What I want is for the subscript-version:

Re: Getting json-value as varchar

2022-01-06 Thread David G. Johnston
On Thursday, January 6, 2022, Andreas Joseph Krogh 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 > >

Re: Getting json-value as varchar

2022-01-06 Thread Andreas Joseph Krogh
På torsdag 06. januar 2022 kl. 13:31:19, skrev Thomas Markus < t.mar...@proventis.net >: Hi, Am 06.01.22 um 13:28 schrieb Andreas Joseph Krogh: Hi, in PG-14 this query returns "value" (with double-quotes): SELECT ('{"key":"value"}'::jsonb)['key']; ┌─┐

Re: Getting json-value as varchar

2022-01-06 Thread Thomas Markus
Hi, Am 06.01.22 um 13:28 schrieb Andreas Joseph Krogh: Hi, in PG-14 this query returns "value" (with double-quotes): SELECT ('{"key":"value"}'::jsonb)['key']; ┌─┐ │  jsonb  │ ├─┤ │ "value" │ └─┘ (1 row) and this returns 'value' (without the quotes): SELECT

Getting json-value as varchar

2022-01-06 Thread Andreas Joseph Krogh
Hi, in PG-14 this query returns "value" (with double-quotes): SELECT ('{"key":"value"}'::jsonb)['key']; ┌─┐ │ jsonb │ ├─┤ │ "value" │ └─┘ (1 row) and this returns 'value' (without the quotes): SELECT ('{"key":"value"}'::jsonb)->> 'key'; ┌──┐ │