Search Postgresql Archives

Re: Turn a json column into a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shaozhong SHI schrieb am 15.02.2022 um 07:23:
> There is a JSON column in a table.  It contains key value pairs, just
> like a dictionary.  What is the best way to turn this column into a
> data table?

jsonb_each() is one option:

  select j.*
  from the_table t
    cross join jsonb_each(t.the_column) as j(key, value);


If the column uses the json type (rather than the recommended jsonb) you can
need to use json_each() instead.







[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux