是否可以在postgres中以单用户模式创建扩展? [英] Do create extension work in single-user mode in postgres?
问题描述
我无法在postgres中以单用户模式创建postgis扩展.但是我可以通过pgadmin来做到这一点.
I can't create postgis extension in single-user mode in postgres. But I can do that from pgadmin.
是否甚至可以在单用户模式下创建扩展?可以找到任何有关此的文档.
Is creating extension in single-user mode even possible? Can find any docs on that.
关于我的问题的完整信息可以在那里看到.
Full info on my question can be seen there.
推荐答案
Anyway, right now I have a comment on the PostgreSQL mailing list.
为什么您会认为这是一件好事?
Why in the world would you think that's a good thing to do?
单用户模式是很少记录的灾难恢复辅助工具.它是 不用于日常活动.有很多行为 您希望在单用户模式下将其关闭.
Single-user mode is a barely-documented disaster recovery aid. It's not meant for routine activity. There are a whole lot of behaviors you want that are turned off in single-user mode.
这不起作用的具体原因是 heap_create_with_catalog:
The specific reason why this doesn't work is this bit in heap_create_with_catalog:
/*
* Decide whether to create an array type over the relation's rowtype. We
* do not create any array types for system catalogs (ie, those made
* during initdb). We do not create them where the use of a relation as
* such is an implementation detail: toast tables, sequences and indexes.
*/
if (IsUnderPostmaster && (relkind == RELKIND_RELATION ||
relkind == RELKIND_VIEW ||
relkind == RELKIND_MATVIEW ||
relkind == RELKIND_FOREIGN_TABLE ||
relkind == RELKIND_COMPOSITE_TYPE))
new_array_oid = AssignTypeArrayOid();
我们可以开发其他机制来检测是否 我们处于initdb序列之内,但我对此并不感到兴奋 将此视为错误.单用户模式尚未被认为是 标准的用户环境,也许是从90年代初开始的.
We could possibly develop some other mechanism for detecting whether we're within the initdb sequence, but I can't get very excited about treating this as a bug. Single-user mode hasn't been considered a standard user environment since maybe the early 90s.
这篇关于是否可以在postgres中以单用户模式创建扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!