Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
29a20145
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
29a20145
编写于
9月 03, 2003
作者:
P
Peter Eisentraut
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass session_authorization to the client and make psql update its prompt
accordingly.
上级
4e85f760
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
54 addition
and
15 deletion
+54
-15
doc/src/sgml/libpq.sgml
doc/src/sgml/libpq.sgml
+3
-2
doc/src/sgml/protocol.sgml
doc/src/sgml/protocol.sgml
+3
-2
doc/src/sgml/ref/psql-ref.sgml
doc/src/sgml/ref/psql-ref.sgml
+18
-5
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+2
-2
src/bin/psql/common.c
src/bin/psql/common.c
+24
-1
src/bin/psql/common.h
src/bin/psql/common.h
+2
-1
src/bin/psql/prompt.c
src/bin/psql/prompt.c
+2
-2
未找到文件。
doc/src/sgml/libpq.sgml
浏览文件 @
29a20145
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.13
4 2003/09/01 23:04:49
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.13
5 2003/09/03 22:05:01
petere Exp $
-->
<chapter id="libpq">
...
...
@@ -857,7 +857,8 @@ is not known.
Parameters reported as of the current release include
<literal>server_version</> (cannot change after startup);
<literal>client_encoding</>,
<literal>is_superuser</>, and
<literal>is_superuser</>,
<literal>session_authorization</literal>, and
<literal>DateStyle</>.
</para>
...
...
doc/src/sgml/protocol.sgml
浏览文件 @
29a20145
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/protocol.sgml,v 1.4
2 2003/09/01 23:04:49
petere Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/protocol.sgml,v 1.4
3 2003/09/03 22:05:07
petere Exp $ -->
<chapter id="protocol">
<title>Frontend/Backend Protocol</title>
...
...
@@ -1006,7 +1006,8 @@
<literal>server_version</> (a pseudo-parameter that cannot change after
startup);
<literal>client_encoding</>,
<literal>is_superuser</>, and
<literal>is_superuser</>,
<literal>session_authorization</literal>, and
<literal>DateStyle</>.
This set might change in the future, or even become configurable.
Accordingly, a frontend should simply ignore ParameterStatus for
...
...
doc/src/sgml/ref/psql-ref.sgml
浏览文件 @
29a20145
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.9
5 2003/08/31 17:32:24
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.9
6 2003/09/03 22:05:08
petere Exp $
PostgreSQL documentation
-->
...
...
@@ -2214,8 +2214,14 @@ testdb=> <userinput>\set content '\'' `sed -e "s/'/\\\\\\'/g" < my_file.txt` '\'
<varlistentry>
<term><literal>%n</literal></term>
<listitem><para>The user name you are connected as (not your local system
user name).</para></listitem>
<listitem>
<para>
The database session user name. (The expansion of this
value might change during a database session as the result
of the command <command>SET SESSION
AUTHORIZATION</command>.)
</para>
</listitem>
</varlistentry>
<varlistentry>
...
...
@@ -2231,8 +2237,15 @@ testdb=> <userinput>\set content '\'' `sed -e "s/'/\\\\\\'/g" < my_file.txt` '\'
<varlistentry>
<term><literal>%#</literal></term>
<listitem><para>If the current user is a database superuser, then a
<literal>#</literal>, otherwise a <literal>></literal>.</para></listitem>
<listitem>
<para>
If the session user is a database superuser, then a
<literal>#</literal>, otherwise a <literal>></literal>.
(The expansion of this value might change during a database
session as the result of the command <command>SET SESSION
AUTHORIZATION</command>.)
</para>
</listitem>
</varlistentry>
<varlistentry>
...
...
src/backend/utils/misc/guc.c
浏览文件 @
29a20145
...
...
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.15
3 2003/09/01 23:04:49
petere Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.15
4 2003/09/03 22:05:08
petere Exp $
*
*--------------------------------------------------------------------
*/
...
...
@@ -1501,7 +1501,7 @@ static struct config_string ConfigureNamesString[] =
{
"session_authorization"
,
PGC_USERSET
,
UNGROUPED
,
gettext_noop
(
"Current session userid"
),
NULL
,
GUC_NO_SHOW_ALL
|
GUC_NO_RESET_ALL
|
GUC_NOT_IN_SAMPLE
|
GUC_DISALLOW_IN_FILE
GUC_
REPORT
|
GUC_
NO_SHOW_ALL
|
GUC_NO_RESET_ALL
|
GUC_NOT_IN_SAMPLE
|
GUC_DISALLOW_IN_FILE
},
&
session_authorization_string
,
NULL
,
assign_session_authorization
,
show_session_authorization
...
...
src/bin/psql/common.c
浏览文件 @
29a20145
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.7
2 2003/08/14 18:48:35 tgl
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.7
3 2003/09/03 22:05:08 petere
Exp $
*/
#include "postgres_fe.h"
#include "common.h"
...
...
@@ -724,3 +724,26 @@ is_superuser(void)
return
false
;
}
/*
* Return the session user of the current connection.
*
* Note: this will correctly detect the session user only with a
* protocol-3.0 or newer backend; otherwise it will return the
* connection user.
*/
const
char
*
session_username
(
void
)
{
const
char
*
val
;
if
(
!
pset
.
db
)
return
NULL
;
val
=
PQparameterStatus
(
pset
.
db
,
"session_authorization"
);
if
(
val
)
return
val
;
else
return
PQuser
(
pset
.
db
);
}
src/bin/psql/common.h
浏览文件 @
29a20145
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/common.h,v 1.2
8 2003/08/08 04:52:21 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/common.h,v 1.2
9 2003/09/03 22:05:09 petere
Exp $
*/
#ifndef COMMON_H
#define COMMON_H
...
...
@@ -37,6 +37,7 @@ extern PGresult *PSQLexec(const char *query, bool start_xact);
extern
bool
SendQuery
(
const
char
*
query
);
extern
bool
is_superuser
(
void
);
extern
const
char
*
session_username
(
void
);
/* Parse a numeric character code from the string pointed at by *buf, e.g.
* one written as 0x0c (hexadecimal) or 015 (octal); advance *buf to the last
...
...
src/bin/psql/prompt.c
浏览文件 @
29a20145
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.2
8 2003/08/04 23:59:40 tgl
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.2
9 2003/09/03 22:05:09 petere
Exp $
*/
#include "postgres_fe.h"
#include "prompt.h"
...
...
@@ -160,7 +160,7 @@ get_prompt(promptStatus_t status)
/* DB server user name */
case
'n'
:
if
(
pset
.
db
)
strncpy
(
buf
,
PQuser
(
pset
.
db
),
MAX_PROMPT_SIZE
);
strncpy
(
buf
,
session_username
(
),
MAX_PROMPT_SIZE
);
break
;
case
'0'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录