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
  • 3,806
  • 2
  • 23
  • 28
JohnDoe
  • 2,252
  • 5
  • 22
  • 41

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,252
  • 5
  • 22
  • 41