客服微信

考试科目:PGCE-E-091
考试题量:44 道单项选择题、29 道多项选择题(每题 2 分)
通过分数:60%
考试时间:60min
本文为云贝教育刘峰(微信:yunbee_DBA)原创,请尊重知识产权,转发请注明出处,不接受任何抄袭、演绎和未经注明出处的转载。
关于set命令说法正确的是
A、set命令可以修改任何参数
B、set命令修改的参数会永久生效
C、set命令只影响当前会话使用的值
D、set与set session效果不同
参考答案:C
1、set只能修改部分参数
修改类型为postmaster的参数失败
testdb=# select distinct context from pg_settings;
context
-------------------
postmaster
superuser-backend
user
internal
backend
sighup
superuser
(7 rows)
testdb=# select name,setting from pg_settings where context='postmaster' limit2;
name | setting
---------------------------+-----------
archive_mode | off
autovacuum_freeze_max_age | 200000000
(2 rows)
testdb=# set archive_mode=on;
ERROR: parameter "archive_mode" cannot be changed without restarting the server
修改类型为user的参数失败
testdb=# select name,setting from pg_settings where context='user' limit 2;
name | setting
------------------+---------
application_name | psql
array_nulls | on
(2 rows)
testdb=# set array_nulls=off;
SET
2、set的设置并不是永久生效的,默认情况下只针对
当前会话生效
testdb=# select name,setting from pg_settings where context='user' limit 2;
name | setting
------------------+---------
application_name | psql
array_nulls | on
(2 rows)
testdb=# set array_nulls=off;
SET
testdb=# show array_nulls;
array_nulls
-------------
off
(1 row)
testdb=# \q
退出重新登录
[postgres@ora19c01 ~]$ psql -d testdb
psql (15.4)
Type "help" for help.
testdb=# select name,setting from pg_settings where context='user' limit 2;
name | setting
------------------+---------
application_name | psql
array_nulls | on
(2 rows)
3、默认情况下,set与set session效果一样
[postgres@ora19c01 ~]$ psql -d testdb
psql (15.4)
Type "help" for help.
testdb=# set session array_nulls=off;
SET
testdb=# show array_nulls;
array_nulls
-------------
off
(1 row)
testdb=# \q
退出重新登录
[postgres@ora19c01 ~]$ psql -d testdb
psql (15.4)
Type "help" for help.
testdb=# select name,setting from pg_settings where context='user' limit 2;
name | setting
------------------+---------
application_name | psql
array_nulls | on
(2 rows)
PostgreSQL PGCE考试为理论考试,需通过两门考试才能拿到“PostgreSQL PGCE证书”。
以下是PostgreSQL官网的考试费,可以添加云贝教育的课程顾问老师微信19941464235或者19906632509,咨询有优惠。

PostgreSQL证书如下 合格考生公布:考后不超过 5 个工作日 “开源软件联盟 PostgreSQL 分会”公众号发布 证书寄送:考后统一寄送至培训机构)

云贝教育有专业的PostgreSQL PGCE认证培训课程,想快速通过考试的同学可以扫码联系老师咨询(点击文字转跳至PostgreSQL PGCE大纲)