Loading topic
json and jsonb. Both accept the same JSON text and both reject invalid JSON. They differ in what they keep after the text arrives, and that difference affects speed, indexing, and what your queries return. This chapter explains how each type stores data an7 min readSELECT, INSERT, UPDATE, WHERE, JOIN), know JSON syntax, and can run CREATE TABLE on7 min readjson and jsonb documents, how they differ in return type, and the errors people hit when they cast the results. It assumes you can write basic SQL (SELECT, WHERE, JOIN), know JSON syntax, and have a PostgreSQL instance, version 12 or6 min readWHERE clause. It assumes you know basic SQL, can read JSON syntax, and have PostgreSQL 12 or later. It also assumes you know the -> and ->> operators from the previous chapter. The examples use the orders 7 min readorders table from the earlier chapters and the -> and ->> operators. If you ran the UPDATE examples from the modifying chapter, re-insert the original two documents so your results match the ones sho7 min readjsonb value in place with jsonb_set, the || operator, and the - operator. It assumes you can write basic UPDATE statements, know JSON syntax, and have the orders table from the earlier chapters. You need PostgreSQL 12 or later.6 min readEXPLAIN output at a basic level, know what a B-tree index is, and have the orders table 7 min read->, ->> and @> operators from earlier chapters, can read JSON syntax, and run PostgreSQL 12 or later. The examples use the orders table from the storing chapter, with its two original rows (Ada and Grace). If you ran the UPDATE examples on order 1, recreat7 min readjsonb operators, containment, and jsonb_typeof. You need PostgreSQL 12 or later. The orders table from earlier chapters is the running example.6 min readjsonb column or in ordinary relational columns and tables. It assumes you have read the earlier chapters on the access operators, jsonb_array_elements, jsonb_set, GIN and expression indexes, and CHECK constraints6 min read->, ->> and @> operators and SQL/JSON path expressions from earlier chapters. PostgreSQL 17 added the SQL-standard JSON query functions JSON_EXISTS, JSON_VALUE, JSON_QUERY and JSON_TABLE. They cover work you could already do with operators and `jsonb_p6 min read