Home > OS >  PostgreSQL: Does jsonb sort Objects in array?
PostgreSQL: Does jsonb sort Objects in array?

Time:03-03

Example: [{3},{1},{2}]. Does it sort it? [{1},{2}, {3}]

I was confused because of this answer? https://stackoverflow.com/a/49833552/15502607

  1. JSON maintains the order in which elements are inserted, while JSONB maintains the "sorted" order.

CodePudding user response:

No, the point in the answer was about the order of the keys in a JSONB object. JSONB arrays maintain the order of their elements in the insertion order.

  • Related