[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 ='DateStyle';
-[ RECORD 1 ]---+-------------------------------------------------------
name | DateStyle
setting | Postgres, DMY --->>重启pg cluster之前的值是"Postgres, DMY"
unit |
category | Client Connection Defaults / Locale and Formatting
short_desc | Sets the display format for date and time values.
extra_desc | Also controls interpretation of ambiguous date inputs.
context | user
vartype | string
source | configuration file
min_val |
max_val |
enumvals |
boot_val | ISO, MDY
reset_val | Postgres, DMY
sourcefile | /pgsqldata/postgresql.conf
sourceline | 567
pending_restart | f
postgres=# show datestyle ;
-[ RECORD 1 ]------------
DateStyle | Postgres, DMY
postgres=# show DaTe --->>此时无法自动补全!!!
postgres=# show DaTe
postgres=# show DaTe
postgres=# show DaTeStyle;
-[ RECORD 1 ]------------
DateStyle | Postgres, DMY
postgres=# show DaTestyle;
-[ RECORD 1 ]------------
DateStyle | Postgres, DMY
postgres=# show daTestyle;
-[ RECORD 1 ]------------
DateStyle | Postgres, DMY
postgres=# show daTeStyle;
-[ RECORD 1 ]------------
DateStyle | Postgres, DMY
postgres=# show daTestyLe;
-[ RECORD 1 ]------------
DateStyle | Postgres, DMY
postgres=# show daTe
postgres=# show daTe
postgres=# show daTe
postgres=# show daTe
postgres=# show daTe
postgres=# \q
[pg104@dbserver pgsqldata]$ pg_ctl stop --->>>停止pg cluster
waiting for server to shut down.... done
server stopped
[pg104@dbserver pgsqldata]$ vi postgresql.conf
[pg104@dbserver pgsqldata]$
[pg104@dbserver pgsqldata]$ grep -i datest postgresql.conf
daTestyle = 'iso, DMY' ---->>>注意参数名称是”daTestyle“,T是大写,其余均小写。参数值已经手工改为”iso, DMY“
[pg104@dbserver pgsqldata]$
[pg104@dbserver pgsqldata]$ pg_ctl start
waiting for server to start....2018-12-20 05:46:29.425 GMT [3740] LOG: skipping missing configuration file "/pgsqldata/postgresql.auto.conf"
2018-12-20 00:46:29.435 EST [3740] LOG: listening on IPv4 address "0.0.0.0", port 5432
2018-12-20 00:46:29.435 EST [3740] LOG: listening on IPv6 address "::", port 5432
2018-12-20 00:46:29.530 EST [3740] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2018-12-20 00:46:29.569 EST [3740] LOG: redirecting log output to logging collector process
2018-12-20 00:46:29.569 EST [3740] HINT: Future log output will appear in directory "log".
done
server started
[pg104@dbserver pgsqldata]$
[pg104@dbserver pgsqldata]$ psql -d postgres
psql (10.4)
Type "help" for help.
postgres=# show datestyle ;
DateStyle
-----------
ISO, DMY ---->>>参数值已经是”iso, DMY“
(1 row)
postgres=# \x
Expanded display is on.
postgres=# select * from pg_settings where name ='DateStyle';
-[ RECORD 1 ]---+-------------------------------------------------------
name | DateStyle
setting | ISO, DMY
unit |
category | Client Connection Defaults / Locale and Formatting
short_desc | Sets the display format for date and time values.
extra_desc | Also controls interpretation of ambiguous date inputs.
context | user
vartype | string
source | configuration file
min_val |
max_val |
enumvals |
boot_val | ISO, MDY
reset_val | ISO, DMY
sourcefile | /pgsqldata/postgresql.conf
sourceline | 567
pending_restart | f
postgres=# show daTe ; --->>此时无法自动补全!!!
postgres=# show daTe ;
postgres=# show daTe ;
postgres=# select * from pg_settings where name ='datestyle';---->>>参数名称全是小写字母,在pg_settings中查询不到。
(0 rows)
postgres=#
总结:
在postgresql.conf中,我敲入的参数名称是“daTestyle“(注意:T是大写,其余均小写),同时敲入的参数值是"iso, DMY",
然后pg cluster起来之后,去查询pg_settings视图,发现如下:
1. 参数名称是"DateStyle"才能在pg_settings视图中查到。
2. 参数名称是"datestyle"不能在pg_settings视图中查到。
这说明如下问题:
pg数据库软件读取$PGDATA/postgresql.conf时,对postgresql.conf中的daTestyle参数名称,是转为”DateStyle“,然后写入pg_settings视图的。