datistemplate of pg_database does not behave as per description in documentation

Поиск
Список
Период
Сортировка
От Rajeev rastogi
Тема datistemplate of pg_database does not behave as per description in documentation
Дата
Msg-id BF2827DCCE55594C8D7A8F7FFD3AB7713DDDD1A7@SZXEML508-MBX.china.huawei.com
обсуждение исходный текст
Ответы Re: datistemplate of pg_database does not behave as per description in documentation  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-hackers

As per the documentation, datistemplate of pg_database is used in following way:

 

datistemplate

Bool

If true then this database can be used in the TEMPLATE clause of CREATE DATABASE to create a new database as a clone of this one

 

But current code does not behave in this manner.  Even if dbistemplate of database is false, still it allows to be used as template database.

 

postgres=# select datname, datistemplate from pg_database;

  datname  | datistemplate

-----------+---------------

template1 | t

template0 | t

postgres  | f

(3 rows)

 

postgres=# create database tempdb template postgres;              ---Actually this should fail.

CREATE DATABASE

 

Though I am not sure if we have to modify source code to align the behavior with documentation or we need to change the documentation itself.

To me it looks like code change will be better, so I am attaching the current patch with source code change.  After modification, result will be as follows:

 

postgres=# create database newtempdb template postgres;

ERROR:  DB name "postgres" given as template is not a template database

 

Please provide your feedback.

 

Thanks and Regards,

Kumar Rajeev Rastogi

Вложения

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

Предыдущее
От: Kyotaro HORIGUCHI
Дата:
Сообщение: Re: inherit support for foreign tables
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: datistemplate of pg_database does not behave as per description in documentation