Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
2498d829
Commit
2498d829
authored
Aug 15, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up some stray remaining references to pg_shadow, pg_user, pg_group.
parent
f590ed12
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
114 additions
and
118 deletions
+114
-118
doc/src/sgml/ref/dropuser.sgml
doc/src/sgml/ref/dropuser.sgml
+24
-25
doc/src/sgml/ref/reindex.sgml
doc/src/sgml/ref/reindex.sgml
+5
-4
doc/src/sgml/xaggr.sgml
doc/src/sgml/xaggr.sgml
+9
-9
src/backend/libpq/crypt.c
src/backend/libpq/crypt.c
+5
-8
src/backend/libpq/pg_hba.conf.sample
src/backend/libpq/pg_hba.conf.sample
+2
-2
src/backend/utils/misc/superuser.c
src/backend/utils/misc/superuser.c
+2
-2
src/bin/scripts/dropuser.c
src/bin/scripts/dropuser.c
+6
-6
src/test/regress/expected/privileges.out
src/test/regress/expected/privileges.out
+24
-24
src/test/regress/sql/privileges.sql
src/test/regress/sql/privileges.sql
+24
-24
src/tutorial/syscat.source
src/tutorial/syscat.source
+13
-14
No files found.
doc/src/sgml/ref/dropuser.sgml
View file @
2498d829
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.3
2 2005/05/29 03:32:18 momjian
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.3
3 2005/08/15 02:40:20 tgl
Exp $
PostgreSQL documentation
-->
...
...
@@ -33,17 +33,16 @@ PostgreSQL documentation
<para>
<application>dropuser</application> removes an existing
<productname>PostgreSQL</productname> user
<emphasis>and</emphasis> the databases which that user owned.
Only superusers (users with <literal>usesuper</literal> set in
the <literal>pg_shadow</literal> table) can destroy
<productname>PostgreSQL</productname> users.
<productname>PostgreSQL</productname> user.
Only superusers and users with the <literal>CREATEROLE</> privilege can
remove <productname>PostgreSQL</productname> users. (To remove a
superuser, you must yourself be a superuser.)
</para>
<para>
<application>dropuser</application> is a wrapper around the
<acronym>SQL</acronym> command <xref linkend="SQL-DROP
USER
"
endterm="SQL-DROP
USER
-title">.
<acronym>SQL</acronym> command <xref linkend="SQL-DROP
ROLE
"
endterm="SQL-DROP
ROLE
-title">.
There is no effective difference between dropping users via
this utility and via other methods for accessing the server.
</para>
...
...
@@ -179,8 +178,8 @@ PostgreSQL documentation
<title>Diagnostics</title>
<para>
In case of difficulty, see <xref linkend="SQL-DROP
USER
"
endterm="sql-drop
user
-title"> and <xref linkend="APP-PSQL"> for
In case of difficulty, see <xref linkend="SQL-DROP
ROLE
"
endterm="sql-drop
role
-title"> and <xref linkend="APP-PSQL"> for
discussions of potential problems and error messages.
The database server must be running at the
targeted host. Also, any default connection settings and environment
...
...
@@ -199,7 +198,7 @@ PostgreSQL documentation
server:
<screen>
<prompt>$ </prompt><userinput>dropuser joe</userinput>
<computeroutput>DROP
USER
</computeroutput>
<computeroutput>DROP
ROLE
</computeroutput>
</screen>
</para>
...
...
@@ -209,10 +208,10 @@ PostgreSQL documentation
command:
<screen>
<prompt>$ </prompt><userinput>dropuser -p 5000 -h eden -i -e joe</userinput>
<computeroutput>
User "joe" and any owned databases will be permanently delet
ed.
<computeroutput>
Role "joe" will be permanently remov
ed.
Are you sure? (y/n) </computeroutput><userinput>y</userinput>
<computeroutput>DROP
USER
"joe"
DROP
USER
</computeroutput>
<computeroutput>DROP
ROLE
"joe"
DROP
ROLE
</computeroutput>
</screen>
</para>
</refsect1>
...
...
@@ -223,7 +222,7 @@ DROP USER</computeroutput>
<simplelist type="inline">
<member><xref linkend="app-createuser"></member>
<member><xref linkend="sql-drop
user" endterm="sql-dropuser
-title"></member>
<member><xref linkend="sql-drop
role" endterm="sql-droprole
-title"></member>
<member>Environment Variables (<xref linkend="libpq-envars">)</member>
</simplelist>
</refsect1>
...
...
doc/src/sgml/ref/reindex.sgml
View file @
2498d829
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/reindex.sgml,v 1.2
7 2005/06/22 21:14:28
tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/reindex.sgml,v 1.2
8 2005/08/15 02:40:20
tgl Exp $
PostgreSQL documentation
-->
...
...
@@ -176,9 +176,10 @@ REINDEX { INDEX | TABLE | DATABASE | SYSTEM } <replaceable class="PARAMETER">nam
<para>
If corruption is suspected in the indexes of any of the shared
system catalogs (<structname>pg_database</structname>,
<structname>pg_group</structname>,
<structname>pg_shadow</structname>, or
system catalogs (<structname>pg_authid</structname>,
<structname>pg_auth_members</structname>,
<structname>pg_database</structname>,
<structname>pg_shdepend</structname>, or
<structname>pg_tablespace</structname>), then a standalone server
must be used to repair it. <command>REINDEX</> will not process
shared catalogs in multiuser mode.
...
...
doc/src/sgml/xaggr.sgml
View file @
2498d829
<!--
$PostgreSQL: pgsql/doc/src/sgml/xaggr.sgml,v 1.2
8 2005/03/30 02:08:39 neilc
Exp $
$PostgreSQL: pgsql/doc/src/sgml/xaggr.sgml,v 1.2
9 2005/08/15 02:40:23 tgl
Exp $
-->
<sect1 id="xaggr">
...
...
@@ -141,22 +141,22 @@ CREATE AGGREGATE array_accum (
<programlisting>
SELECT attrelid::regclass, array_accum(attname)
FROM pg_attribute
WHERE attnum > 0 AND attrelid = 'pg_
user
'::regclass
WHERE attnum > 0 AND attrelid = 'pg_
tablespace
'::regclass
GROUP BY attrelid;
attrelid | array_accum
----------
+--------------------------------------
---------------------------------------
pg_
user | {usename,usesysid,usecreatedb,usesuper,usecatupd,passwd,valuntil,useconfig
}
----------
-----+
---------------------------------------
pg_
tablespace | {spcname,spcowner,spclocation,spcacl
}
(1 row)
SELECT attrelid::regclass, array_accum(atttypid)
FROM pg_attribute
WHERE attnum > 0 AND attrelid = 'pg_
user
'::regclass
WHERE attnum > 0 AND attrelid = 'pg_
tablespace
'::regclass
GROUP BY attrelid;
attrelid | array_accum
----------
+-------------
-----------------
pg_
user | {19,23,16,16,16,25,702,1009
}
----------
-----+
-----------------
pg_
tablespace | {19,26,25,1034
}
(1 row)
</programlisting>
</para>
...
...
src/backend/libpq/crypt.c
View file @
2498d829
...
...
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/libpq/crypt.c,v 1.6
4 2005/06/29 22:51:54
tgl Exp $
* $PostgreSQL: pgsql/src/backend/libpq/crypt.c,v 1.6
5 2005/08/15 02:40:25
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -57,7 +57,7 @@ md5_crypt_verify(const Port *port, const char *role, char *client_pass)
if
(
shadow_pass
==
NULL
||
*
shadow_pass
==
'\0'
)
return
STATUS_ERROR
;
/* We can't do crypt with
pg_shadow
MD5 passwords */
/* We can't do crypt with MD5 passwords */
if
(
isMD5
(
shadow_pass
)
&&
port
->
auth_method
==
uaCrypt
)
{
ereport
(
LOG
,
...
...
@@ -75,7 +75,7 @@ md5_crypt_verify(const Port *port, const char *role, char *client_pass)
crypt_pwd
=
palloc
(
MD5_PASSWD_LEN
+
1
);
if
(
isMD5
(
shadow_pass
))
{
/*
pg_shadow
already encrypted, only do salt */
/*
stored password
already encrypted, only do salt */
if
(
!
EncryptMD5
(
shadow_pass
+
strlen
(
"md5"
),
(
char
*
)
port
->
md5Salt
,
sizeof
(
port
->
md5Salt
),
crypt_pwd
))
...
...
@@ -86,7 +86,7 @@ md5_crypt_verify(const Port *port, const char *role, char *client_pass)
}
else
{
/*
pg_shadow
plain, double-encrypt */
/*
stored password is
plain, double-encrypt */
char
*
crypt_pwd2
=
palloc
(
MD5_PASSWD_LEN
+
1
);
if
(
!
EncryptMD5
(
shadow_pass
,
...
...
@@ -121,10 +121,7 @@ md5_crypt_verify(const Port *port, const char *role, char *client_pass)
default:
if
(
isMD5
(
shadow_pass
))
{
/*
* Encrypt user-supplied password to match MD5 in
* pg_shadow
*/
/* Encrypt user-supplied password to match stored MD5 */
crypt_client_pass
=
palloc
(
MD5_PASSWD_LEN
+
1
);
if
(
!
EncryptMD5
(
client_pass
,
port
->
user_name
,
...
...
src/backend/libpq/pg_hba.conf.sample
View file @
2498d829
...
...
@@ -20,7 +20,7 @@
# "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an
# SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "same
group
", a database name, or
# DATABASE can be "all", "sameuser", "same
role
", a database name, or
# a comma-separated list thereof.
#
# USER can be "all", a user name, a group name prefixed with "+", or
...
...
@@ -42,7 +42,7 @@
#
# Database and user names containing spaces, commas, quotes and other special
# characters must be quoted. Quoting one of the keywords "all", "sameuser" or
# "same
group
" makes the name lose its special character, and just match a
# "same
role
" makes the name lose its special character, and just match a
# database or username with that name.
#
# This file is read on server startup and when the postmaster receives
...
...
src/backend/utils/misc/superuser.c
View file @
2498d829
...
...
@@ -5,7 +5,7 @@
*
* All code should use either of these two functions to find out
* whether a given user is a superuser, rather than examining
* pg_
shadow.use
super directly, so that the escape hatch built in for
* pg_
authid.rol
super directly, so that the escape hatch built in for
* the single-user case works.
*
*
...
...
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/superuser.c,v 1.3
2 2005/06/28 05:09:02
tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/superuser.c,v 1.3
3 2005/08/15 02:40:26
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
src/bin/scripts/dropuser.c
View file @
2498d829
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.1
4 2005/06/21 04:02:33
tgl Exp $
* $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.1
5 2005/08/15 02:40:28
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -101,20 +101,20 @@ main(int argc, char *argv[])
}
if
(
dropuser
==
NULL
)
dropuser
=
simple_prompt
(
"Enter name of
user
to drop: "
,
128
,
true
);
dropuser
=
simple_prompt
(
"Enter name of
role
to drop: "
,
128
,
true
);
if
(
interactive
)
{
char
*
reply
;
printf
(
_
(
"
User
\"
%s
\"
will be permanently removed.
\n
"
),
dropuser
);
printf
(
_
(
"
Role
\"
%s
\"
will be permanently removed.
\n
"
),
dropuser
);
reply
=
simple_prompt
(
"Are you sure? (y/n) "
,
1
,
true
);
if
(
check_yesno_response
(
reply
)
!=
1
)
exit
(
0
);
}
initPQExpBuffer
(
&
sql
);
appendPQExpBuffer
(
&
sql
,
"DROP
USER
%s;
\n
"
,
fmtId
(
dropuser
));
appendPQExpBuffer
(
&
sql
,
"DROP
ROLE
%s;
\n
"
,
fmtId
(
dropuser
));
conn
=
connectDatabase
(
"postgres"
,
host
,
port
,
username
,
password
,
progname
);
...
...
@@ -124,7 +124,7 @@ main(int argc, char *argv[])
if
(
PQresultStatus
(
result
)
!=
PGRES_COMMAND_OK
)
{
fprintf
(
stderr
,
_
(
"%s: removal of
user
\"
%s
\"
failed: %s"
),
fprintf
(
stderr
,
_
(
"%s: removal of
role
\"
%s
\"
failed: %s"
),
progname
,
dropuser
,
PQerrorMessage
(
conn
));
PQfinish
(
conn
);
exit
(
1
);
...
...
@@ -133,7 +133,7 @@ main(int argc, char *argv[])
PQfinish
(
conn
);
if
(
!
quiet
)
{
puts
(
"DROP
USER
"
);
puts
(
"DROP
ROLE
"
);
fflush
(
stdout
);
}
exit
(
0
);
...
...
src/test/regress/expected/privileges.out
View file @
2498d829
...
...
@@ -306,15 +306,15 @@ select has_table_privilege(current_user,'pg_authid','insert');
t
(1 row)
select has_table_privilege(t2.
usesys
id,'pg_authid','update')
from (select
usesysid from pg_user where use
name = current_user) as t2;
select has_table_privilege(t2.
o
id,'pg_authid','update')
from (select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
t
(1 row)
select has_table_privilege(t2.
usesys
id,'pg_authid','delete')
from (select
usesysid from pg_user where use
name = current_user) as t2;
select has_table_privilege(t2.
o
id,'pg_authid','delete')
from (select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
t
...
...
@@ -334,17 +334,17 @@ from (select oid from pg_class where relname = 'pg_authid') as t1;
t
(1 row)
select has_table_privilege(t2.
usesys
id,t1.oid,'select')
select has_table_privilege(t2.
o
id,t1.oid,'select')
from (select oid from pg_class where relname = 'pg_authid') as t1,
(select
usesysid from pg_user where use
name = current_user) as t2;
(select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
t
(1 row)
select has_table_privilege(t2.
usesys
id,t1.oid,'insert')
select has_table_privilege(t2.
o
id,t1.oid,'insert')
from (select oid from pg_class where relname = 'pg_authid') as t1,
(select
usesysid from pg_user where use
name = current_user) as t2;
(select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
t
...
...
@@ -390,15 +390,15 @@ select has_table_privilege(current_user,'pg_class','insert');
f
(1 row)
select has_table_privilege(t2.
usesys
id,'pg_class','update')
from (select
usesysid from pg_user where use
name = current_user) as t2;
select has_table_privilege(t2.
o
id,'pg_class','update')
from (select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
f
(1 row)
select has_table_privilege(t2.
usesys
id,'pg_class','delete')
from (select
usesysid from pg_user where use
name = current_user) as t2;
select has_table_privilege(t2.
o
id,'pg_class','delete')
from (select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
f
...
...
@@ -418,17 +418,17 @@ from (select oid from pg_class where relname = 'pg_class') as t1;
f
(1 row)
select has_table_privilege(t2.
usesys
id,t1.oid,'select')
select has_table_privilege(t2.
o
id,t1.oid,'select')
from (select oid from pg_class where relname = 'pg_class') as t1,
(select
usesysid from pg_user where use
name = current_user) as t2;
(select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
t
(1 row)
select has_table_privilege(t2.
usesys
id,t1.oid,'insert')
select has_table_privilege(t2.
o
id,t1.oid,'insert')
from (select oid from pg_class where relname = 'pg_class') as t1,
(select
usesysid from pg_user where use
name = current_user) as t2;
(select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
f
...
...
@@ -472,15 +472,15 @@ select has_table_privilege(current_user,'atest1','insert');
f
(1 row)
select has_table_privilege(t2.
usesys
id,'atest1','update')
from (select
usesysid from pg_user where use
name = current_user) as t2;
select has_table_privilege(t2.
o
id,'atest1','update')
from (select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
f
(1 row)
select has_table_privilege(t2.
usesys
id,'atest1','delete')
from (select
usesysid from pg_user where use
name = current_user) as t2;
select has_table_privilege(t2.
o
id,'atest1','delete')
from (select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
f
...
...
@@ -500,17 +500,17 @@ from (select oid from pg_class where relname = 'atest1') as t1;
f
(1 row)
select has_table_privilege(t2.
usesys
id,t1.oid,'select')
select has_table_privilege(t2.
o
id,t1.oid,'select')
from (select oid from pg_class where relname = 'atest1') as t1,
(select
usesysid from pg_user where use
name = current_user) as t2;
(select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
t
(1 row)
select has_table_privilege(t2.
usesys
id,t1.oid,'insert')
select has_table_privilege(t2.
o
id,t1.oid,'insert')
from (select oid from pg_class where relname = 'atest1') as t1,
(select
usesysid from pg_user where use
name = current_user) as t2;
(select
oid from pg_roles where rol
name = current_user) as t2;
has_table_privilege
---------------------
f
...
...
src/test/regress/sql/privileges.sql
View file @
2498d829
...
...
@@ -205,22 +205,22 @@ select has_table_privilege(1,'rule');
select
has_table_privilege
(
current_user
,
'pg_authid'
,
'select'
);
select
has_table_privilege
(
current_user
,
'pg_authid'
,
'insert'
);
select
has_table_privilege
(
t2
.
usesys
id
,
'pg_authid'
,
'update'
)
from
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
usesys
id
,
'pg_authid'
,
'delete'
)
from
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
o
id
,
'pg_authid'
,
'update'
)
from
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
o
id
,
'pg_authid'
,
'delete'
)
from
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
current_user
,
t1
.
oid
,
'rule'
)
from
(
select
oid
from
pg_class
where
relname
=
'pg_authid'
)
as
t1
;
select
has_table_privilege
(
current_user
,
t1
.
oid
,
'references'
)
from
(
select
oid
from
pg_class
where
relname
=
'pg_authid'
)
as
t1
;
select
has_table_privilege
(
t2
.
usesys
id
,
t1
.
oid
,
'select'
)
select
has_table_privilege
(
t2
.
o
id
,
t1
.
oid
,
'select'
)
from
(
select
oid
from
pg_class
where
relname
=
'pg_authid'
)
as
t1
,
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
usesys
id
,
t1
.
oid
,
'insert'
)
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
o
id
,
t1
.
oid
,
'insert'
)
from
(
select
oid
from
pg_class
where
relname
=
'pg_authid'
)
as
t1
,
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
'pg_authid'
,
'update'
);
select
has_table_privilege
(
'pg_authid'
,
'delete'
);
...
...
@@ -236,22 +236,22 @@ SET SESSION AUTHORIZATION regressuser3;
select
has_table_privilege
(
current_user
,
'pg_class'
,
'select'
);
select
has_table_privilege
(
current_user
,
'pg_class'
,
'insert'
);
select
has_table_privilege
(
t2
.
usesys
id
,
'pg_class'
,
'update'
)
from
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
usesys
id
,
'pg_class'
,
'delete'
)
from
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
o
id
,
'pg_class'
,
'update'
)
from
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
o
id
,
'pg_class'
,
'delete'
)
from
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
current_user
,
t1
.
oid
,
'rule'
)
from
(
select
oid
from
pg_class
where
relname
=
'pg_class'
)
as
t1
;
select
has_table_privilege
(
current_user
,
t1
.
oid
,
'references'
)
from
(
select
oid
from
pg_class
where
relname
=
'pg_class'
)
as
t1
;
select
has_table_privilege
(
t2
.
usesys
id
,
t1
.
oid
,
'select'
)
select
has_table_privilege
(
t2
.
o
id
,
t1
.
oid
,
'select'
)
from
(
select
oid
from
pg_class
where
relname
=
'pg_class'
)
as
t1
,
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
usesys
id
,
t1
.
oid
,
'insert'
)
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
o
id
,
t1
.
oid
,
'insert'
)
from
(
select
oid
from
pg_class
where
relname
=
'pg_class'
)
as
t1
,
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
'pg_class'
,
'update'
);
select
has_table_privilege
(
'pg_class'
,
'delete'
);
...
...
@@ -264,22 +264,22 @@ from (select oid from pg_class where relname = 'pg_class') as t1;
select
has_table_privilege
(
current_user
,
'atest1'
,
'select'
);
select
has_table_privilege
(
current_user
,
'atest1'
,
'insert'
);
select
has_table_privilege
(
t2
.
usesys
id
,
'atest1'
,
'update'
)
from
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
usesys
id
,
'atest1'
,
'delete'
)
from
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
o
id
,
'atest1'
,
'update'
)
from
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
o
id
,
'atest1'
,
'delete'
)
from
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
current_user
,
t1
.
oid
,
'rule'
)
from
(
select
oid
from
pg_class
where
relname
=
'atest1'
)
as
t1
;
select
has_table_privilege
(
current_user
,
t1
.
oid
,
'references'
)
from
(
select
oid
from
pg_class
where
relname
=
'atest1'
)
as
t1
;
select
has_table_privilege
(
t2
.
usesys
id
,
t1
.
oid
,
'select'
)
select
has_table_privilege
(
t2
.
o
id
,
t1
.
oid
,
'select'
)
from
(
select
oid
from
pg_class
where
relname
=
'atest1'
)
as
t1
,
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
usesys
id
,
t1
.
oid
,
'insert'
)
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
t2
.
o
id
,
t1
.
oid
,
'insert'
)
from
(
select
oid
from
pg_class
where
relname
=
'atest1'
)
as
t1
,
(
select
usesysid
from
pg_user
where
use
name
=
current_user
)
as
t2
;
(
select
oid
from
pg_roles
where
rol
name
=
current_user
)
as
t2
;
select
has_table_privilege
(
'atest1'
,
'update'
);
select
has_table_privilege
(
'atest1'
,
'delete'
);
...
...
src/tutorial/syscat.source
View file @
2498d829
...
...
@@ -7,7 +7,7 @@
-- Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
-- Portions Copyright (c) 1994, Regents of the University of California
--
-- $PostgreSQL: pgsql/src/tutorial/syscat.source,v 1.1
4 2004/12/31 22:04:05 pgsq
l Exp $
-- $PostgreSQL: pgsql/src/tutorial/syscat.source,v 1.1
5 2005/08/15 02:40:36 tg
l Exp $
--
---------------------------------------------------------------------------
...
...
@@ -18,13 +18,12 @@
SET SEARCH_PATH TO pg_catalog;
--
-- lists the name of all database adminstrators and the name of their
-- database(s)
-- lists the names of all database owners and the name of their database(s)
--
SELECT
use
name, datname
FROM pg_
user
, pg_database
WHERE
usesys
id = datdba
ORDER BY
use
name, datname;
SELECT
rol
name, datname
FROM pg_
roles
, pg_database
WHERE
pg_roles.o
id = datdba
ORDER BY
rol
name, datname;
--
-- lists all user-defined classes
...
...
@@ -81,15 +80,15 @@ SELECT n.nspname, c.relname, a.attname, format_type(t.oid, null) as typname
--
-- lists all user-defined base types (not including array types)
--
SELECT n.nspname,
u.use
name, format_type(t.oid, null) as typname
FROM pg_type t, pg_
user u
, pg_namespace n
WHERE
u.usesys
id = t.typowner
SELECT n.nspname,
r.rol
name, format_type(t.oid, null) as typname
FROM pg_type t, pg_
roles r
, pg_namespace n
WHERE
r.o
id = t.typowner
and t.typnamespace = n.oid
and t.typrelid =
'0'::oid
-- no complex types
and t.typelem =
'0'::oid
-- no arrays
and n.nspname not like 'pg\\_%' -- no
catalog
s
and t.typrelid =
0
-- no complex types
and t.typelem =
0
-- no arrays
and n.nspname not like 'pg\\_%' -- no
built-in type
s
and n.nspname != 'information_schema' -- no information_schema
ORDER BY nspname,
use
name, typname;
ORDER BY nspname,
rol
name, typname;
--
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment