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
e36de181
Commit
e36de181
authored
Aug 14, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix psql's \d commands to use pg_roles instead of pg_user, so that
they don't miss owners that are NOLOGIN.
parent
84ccf721
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
20 deletions
+16
-20
src/bin/psql/describe.c
src/bin/psql/describe.c
+16
-20
No files found.
src/bin/psql/describe.c
View file @
e36de181
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.12
3 2005/08/14 18:49:30
tgl Exp $
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.12
4 2005/08/14 19:20:45
tgl Exp $
*/
#include "postgres_fe.h"
#include "describe.h"
...
...
@@ -177,7 +177,7 @@ describeFunctions(const char *pattern, bool verbose)
if
(
verbose
)
appendPQExpBuffer
(
&
buf
,
",
\n
u.use
name as
\"
%s
\"
,
\n
"
",
\n
r.rol
name as
\"
%s
\"
,
\n
"
" l.lanname as
\"
%s
\"
,
\n
"
" p.prosrc as
\"
%s
\"
,
\n
"
" pg_catalog.obj_description(p.oid, 'pg_proc') as
\"
%s
\"
"
,
...
...
@@ -193,7 +193,7 @@ describeFunctions(const char *pattern, bool verbose)
"
\n
FROM pg_catalog.pg_proc p"
"
\n
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace"
"
\n
LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang"
"
\n
LEFT JOIN pg_catalog.pg_
user u ON u.usesys
id = p.proowner
\n
"
);
"
\n
LEFT JOIN pg_catalog.pg_
roles r ON r.o
id = p.proowner
\n
"
);
/*
* we skip in/out funcs by excluding functions that take or return
...
...
@@ -357,7 +357,7 @@ listAllDbs(bool verbose)
printfPQExpBuffer
(
&
buf
,
"SELECT d.datname as
\"
%s
\"
,
\n
"
"
u.use
name as
\"
%s
\"
"
,
"
r.rol
name as
\"
%s
\"
"
,
_
(
"Name"
),
_
(
"Owner"
));
appendPQExpBuffer
(
&
buf
,
",
\n
pg_catalog.pg_encoding_to_char(d.encoding) as
\"
%s
\"
"
,
...
...
@@ -368,7 +368,7 @@ listAllDbs(bool verbose)
_
(
"Description"
));
appendPQExpBuffer
(
&
buf
,
"
\n
FROM pg_catalog.pg_database d"
"
\n
LEFT JOIN pg_catalog.pg_
user u ON d.datdba = u.usesys
id
\n
"
"
\n
LEFT JOIN pg_catalog.pg_
roles r ON d.datdba = r.o
id
\n
"
"ORDER BY 1;"
);
res
=
PSQLexec
(
buf
.
data
,
false
);
...
...
@@ -1462,7 +1462,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
"SELECT n.nspname as
\"
%s
\"
,
\n
"
" c.relname as
\"
%s
\"
,
\n
"
" CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'i' THEN '%s' WHEN 'S' THEN '%s' WHEN 's' THEN '%s' END as
\"
%s
\"
,
\n
"
"
u.use
name as
\"
%s
\"
"
,
"
r.rol
name as
\"
%s
\"
"
,
_
(
"Schema"
),
_
(
"Name"
),
_
(
"table"
),
_
(
"view"
),
_
(
"index"
),
_
(
"sequence"
),
_
(
"special"
),
_
(
"Type"
),
_
(
"Owner"
));
...
...
@@ -1477,20 +1477,16 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
",
\n
pg_catalog.obj_description(c.oid, 'pg_class') as
\"
%s
\"
"
,
_
(
"Description"
));
appendPQExpBuffer
(
&
buf
,
"
\n
FROM pg_catalog.pg_class c"
"
\n
LEFT JOIN pg_catalog.pg_roles r ON r.oid = c.relowner"
"
\n
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace"
);
if
(
showIndexes
)
appendPQExpBuffer
(
&
buf
,
"
\n
FROM pg_catalog.pg_class c"
"
\n
JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid"
"
\n
JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid"
"
\n
LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner"
"
\n
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
\n
"
);
else
appendPQExpBuffer
(
&
buf
,
"
\n
FROM pg_catalog.pg_class c"
"
\n
LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner"
"
\n
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
\n
"
);
"
\n
LEFT JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid"
"
\n
LEFT JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid"
);
appendPQExpBuffer
(
&
buf
,
"WHERE c.relkind IN ("
);
appendPQExpBuffer
(
&
buf
,
"
\n
WHERE c.relkind IN ("
);
if
(
showTables
)
appendPQExpBuffer
(
&
buf
,
"'r',"
);
if
(
showViews
)
...
...
@@ -1716,7 +1712,7 @@ listSchemas(const char *pattern, bool verbose)
initPQExpBuffer
(
&
buf
);
printfPQExpBuffer
(
&
buf
,
"SELECT n.nspname AS
\"
%s
\"
,
\n
"
"
u.use
name AS
\"
%s
\"
"
,
"
r.rol
name AS
\"
%s
\"
"
,
_
(
"Name"
),
_
(
"Owner"
));
if
(
verbose
)
...
...
@@ -1726,8 +1722,8 @@ listSchemas(const char *pattern, bool verbose)
_
(
"Access privileges"
),
_
(
"Description"
));
appendPQExpBuffer
(
&
buf
,
"
\n
FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_
user u
\n
"
" ON n.nspowner=
u.usesys
id
\n
"
"
\n
FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_
roles r
\n
"
" ON n.nspowner=
r.o
id
\n
"
"WHERE (n.nspname !~ '^pg_temp_' OR
\n
"
" n.nspname = (pg_catalog.current_schemas(true))[1])
\n
"
);
/* temp schema is first */
...
...
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