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
f26e1d39
Commit
f26e1d39
authored
Aug 04, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Indices display to \d command.
parent
0b442388
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
8 deletions
+39
-8
src/bin/psql/psql.c
src/bin/psql/psql.c
+39
-8
No files found.
src/bin/psql/psql.c
View file @
f26e1d39
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.1
49 1998/07/26 01:18:07
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.1
50 1998/08/04 18:29:41
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -408,12 +408,7 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type,
strcat
(
listbuf
,
" and relname !~ '^pg_'"
);
else
strcat
(
listbuf
,
" and relname ~ '^pg_'"
);
strcat
(
listbuf
,
" and relname !~ '^xin[vx][0-9]+'"
);
/*
* the usesysid = relowner won't work on stock 1.0 dbs, need to add in
* the int4oideq function
*/
strcat
(
listbuf
,
" and relname !~ '^xin[vx][0-9]+'"
);
strcat
(
listbuf
,
" and usesysid = relowner"
);
strcat
(
listbuf
,
" ORDER BY relname "
);
if
(
!
(
res
=
PSQLexec
(
pset
,
listbuf
)))
...
...
@@ -595,6 +590,7 @@ rightsList(PsqlSettings *pset)
}
else
{
PQclear
(
res
);
fprintf
(
stderr
,
"Couldn't find any tables!
\n
"
);
return
-
1
;
}
...
...
@@ -611,7 +607,7 @@ int
tableDesc
(
PsqlSettings
*
pset
,
char
*
table
,
FILE
*
fout
)
{
char
descbuf
[
512
];
int
nColumns
;
int
nColumns
,
nIndices
;
char
*
rtype
;
char
*
rnotnull
;
char
*
rhasdef
;
...
...
@@ -765,6 +761,40 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
}
fprintf
(
fout
,
"+----------------------------------+----------------------------------+-------+
\n
"
);
PQclear
(
res
);
/* display defined indexes for this table */
descbuf
[
0
]
=
'\0'
;
strcat
(
descbuf
,
"SELECT c2.relname "
);
strcat
(
descbuf
,
"FROM pg_class c, pg_class c2, pg_index i "
);
strcat
(
descbuf
,
"WHERE c.relname = '"
);
strcat
(
descbuf
,
table
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
" and c.oid = i.indrelid "
);
strcat
(
descbuf
,
" and i.indexrelid = c2.oid "
);
strcat
(
descbuf
,
" ORDER BY c2.relname "
);
if
((
res
=
PSQLexec
(
pset
,
descbuf
)))
{
nIndices
=
PQntuples
(
res
);
if
(
nIndices
>
0
)
{
/*
* Display the information
*/
if
(
nIndices
==
1
)
fprintf
(
fout
,
"Indices: "
);
else
fprintf
(
fout
,
"Index: "
);
/* next, print out the instances */
for
(
i
=
0
;
i
<
PQntuples
(
res
);
i
++
)
if
(
i
==
0
)
fprintf
(
fout
,
"%s
\n
"
,
PQgetvalue
(
res
,
i
,
0
));
else
fprintf
(
fout
,
" %s
\n
"
,
PQgetvalue
(
res
,
i
,
0
));
}
PQclear
(
res
);
}
if
(
usePipe
)
{
pclose
(
fout
);
...
...
@@ -774,6 +804,7 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
}
else
{
PQclear
(
res
);
fprintf
(
stderr
,
"Couldn't find table %s!
\n
"
,
table
);
return
-
1
;
}
...
...
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