| Документация по PostgreSQL 9.4.1 | |||
|---|---|---|---|
| Пред. | Уровень выше | Глава 60. Внутренний интерфейс BKI | След. |
60.3. Структура файла BKI
Команда open может применяться, только когда открываемая ей таблица существует и для неё имеются записи в каталогах. (Минимальный набор этих каталогов образуют pg_class, pg_attribute, pg_proc и pg_type.) Чтобы можно было заполнить сами эти таблицы, команда create с указанием bootstrap неявно открывает создаваемую таблицу для добавления данных.
Кроме того, команды declare index и declare toast нельзя применять, пока не будут созданы и заполнены системные каталоги.
Таким образом, файл postgres.bki должен иметь следующую структуру:
create bootstrap (создание) одной из критичных таблиц
insert (добавление) данных, описывающих как минимум критичные таблицы
close
Повторение для других критичных таблиц.
create (создание) (без bootstrap) некритичной таблицы
open
insert (добавление) требуемых данных
close
Повторение для других некритичных таблиц.
Определение индексов и таблиц TOAST.
build indices
Несомненно есть и другие, недокументированные зависимости, диктующие определённый порядок.
| Пред. | Начало | След. |
| Команды BKI | Уровень выше | Пример |
| PostgreSQL 9.4.1 Documentation | |||
|---|---|---|---|
| Prev | Up | Chapter 60. BKI Backend Interface | Next |
60.3. Structure of the Bootstrap BKI File
The open command cannot be used until the tables it uses exist and have entries for the table that is to be opened. (These minimum tables are pg_class, pg_attribute, pg_proc, and pg_type.) To allow those tables themselves to be filled, create with the bootstrap option implicitly opens the created table for data insertion.
Also, the declare index and declare toast commands cannot be used until the system catalogs they need have been created and filled in.
Thus, the structure of the postgres.bki file has to be:
create bootstrap one of the critical tables
insert data describing at least the critical tables
close
Repeat for the other critical tables.
create (without bootstrap) a noncritical table
open
insert desired data
close
Repeat for the other noncritical tables.
Define indexes and toast tables.
build indices
There are doubtless other, undocumented ordering dependencies.