Postgresql数据库的参数名称大小写问题-以max_cOnneCtioNs参数举例

本文探讨了PostgreSQL如何处理postgresql.conf文件中的max_connections参数。即使在配置文件中使用了大小写混合的参数名,如'max_cOnneCtioNs',PostgreSQL也会将其转换为全小写形式并应用到pg_settings视图中。这一特性展示了PostgreSQL在配置参数读取上的大小写不敏感性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[pg104@dbserver pgsqldata]$ pg_ctl start
waiting for server to start....2018-12-20 06:28:52.359 GMT [4317] LOG:  skipping missing configuration file "/pgsqldata/postgresql.auto.conf"
2018-12-20 01:28:52.364 EST [4317] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2018-12-20 01:28:52.365 EST [4317] LOG:  listening on IPv6 address "::", port 5432
2018-12-20 01:28:52.367 EST [4317] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2018-12-20 01:28:52.394 EST [4317] LOG:  redirecting log output to logging collector process
2018-12-20 01:28:52.394 EST [4317] HINT:  Future log output will appear in directory "log".
 done
server started
[pg104@dbserver pgsqldata]$ egrep -i max_connections  postgresql.conf
max_cOnneCtioNs = 173            # (change requires restart) ——>>注意参数名称是大小写混杂的
[pg104@dbserver pgsqldata]$ psql -d postgres
psql (10.4)
Type "help" for help.

postgres=# \x
Expanded display is on.
postgres=# select *  from pg_settings where name ='max_connections';
-[ RECORD 1 ]---+-----------------------------------------------------
name            | max_connections
setting         | 173
unit            | 
category        | Connections and Authentication / Connection Settings
short_desc      | Sets the maximum number of concurrent connections.
extra_desc      | 
context         | postmaster
vartype         | integer
source          | configuration file
min_val         | 1
max_val         | 262143
enumvals        | 
boot_val        | 100
reset_val       | 173
sourcefile      | /pgsqldata/postgresql.conf
sourceline      | 65
pending_restart | f

postgres=# select *  from pg_settings where name ='maX_connections';
(0 rows)

postgres=# show max_connections ;
-[ RECORD 1 ]---+----
max_connections | 173

postgres=# 

在postgresql.conf中,我敲入的参数名称是“max_cOnneCtioNs”(此时参数值是173),注意是大小写混杂的字母,

然后pg cluster起来之后,去查询pg_settings视图,发现如下:
1. 参数名称是全小写的max_connections

2.参数值已经变成了173

这说明如下问题:
pg数据库软件读取$PGDATA/postgresql.conf时,对postgresql.conf中的max_cOnneCtioNs参数名称,是转为全小写,然后写入pg_settings视图的。

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值