JSONB filed with default JSON from a file

Поиск
Список
Период
Сортировка
От mrcasa bengaluru
Тема JSONB filed with default JSON from a file
Дата
Msg-id CALpZ+ORgw=ZjZDBJ32E4ucuZBtVnHEHQ4=GM2Ex+w378QwBAXQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: JSONB filed with default JSON from a file
Список pgsql-general
All,

I'm new to JSONB datatype. We would like to store a nested JSON file in this field. Since the JSON is nested, we wanted to create JSON with default value from an external JSON file.

My address table looks like,

CREATE TABLE address (
id CHAR(36) UNIQUE NOT NULL,
address JSONB NOT NULL
);

For example, the default JSON will look like,

$ cat address_default.json

{
  "address": {
    "address1": "175 N Street",
    "address2": "Timabktu",
    "location": [
      {
        "city": "Utopia",
        "geolocation": [
          {
            "lat": "12.345",
            "long": "12.1234"
          }
        ],
        "state": "Nowhere"
      }
    ],
    "zip": "96001"
  }
}


How do I make the address_default.json as the default JSON value for the address column?

В списке pgsql-general по дате отправления:

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: How to get connection details from psql -> \e
Следующее
От: Charles Clavadetscher
Дата:
Сообщение: Re: JSONB filed with default JSON from a file