0

Assume a Postgresql table which contains a JSON column. Now how do I get only those table rows which match a certain 'JSON-Schema'?

I was hoping that

select category#>'{Kategorie}' from dataset where category#>'{Kategorie}' is not null

would only get me those rows which match the {Kategorie} Schema.

Dmitri Goldring
  • 4,176
  • 2
  • 24
  • 28
JohnDoe
  • 2,422
  • 5
  • 29
  • 44

1 Answers1

0

Thanks to the pointer provided by @dommage, the syntax actually is

select category#>'{Kategorie}' from dataset where (category#>'{Kategorie}') is not null

The parantheses arround the json-extraction operation in the where clause are crucial.

JohnDoe
  • 2,422
  • 5
  • 29
  • 44