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
4e9df155
Commit
4e9df155
authored
Nov 15, 1997
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new \df psql option and oid8types() function.
parent
2e0976e0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
6 deletions
+101
-6
src/backend/utils/adt/regproc.c
src/backend/utils/adt/regproc.c
+77
-2
src/bin/psql/psql.c
src/bin/psql/psql.c
+16
-1
src/include/catalog/pg_proc.h
src/include/catalog/pg_proc.h
+3
-1
src/include/utils/builtins.h
src/include/utils/builtins.h
+2
-1
src/man/psql.1
src/man/psql.1
+3
-1
No files found.
src/backend/utils/adt/regproc.c
View file @
4e9df155
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.
8 1997/10/25 01:10:45
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.
9 1997/11/15 16:32:01
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -118,7 +118,7 @@ regprocout(RegProcedure proid)
...
@@ -118,7 +118,7 @@ regprocout(RegProcedure proid)
if
(
!
HeapScanIsValid
(
procscan
))
if
(
!
HeapScanIsValid
(
procscan
))
{
{
heap_close
(
proc
);
heap_close
(
proc
);
elog
(
WARN
,
"regproc
in
: could not being scan of %s"
,
elog
(
WARN
,
"regproc
out
: could not being scan of %s"
,
ProcedureRelationName
);
ProcedureRelationName
);
return
(
0
);
return
(
0
);
}
}
...
@@ -150,6 +150,81 @@ regprocout(RegProcedure proid)
...
@@ -150,6 +150,81 @@ regprocout(RegProcedure proid)
return
(
result
);
return
(
result
);
}
}
/*
* int8typeout - converts int8 type oids to "typname" list
*/
text
*
oid8types
(
Oid
(
*
oidArray
)[])
{
Relation
type
;
HeapScanDesc
typescan
;
HeapTuple
typetup
;
text
*
result
;
ScanKeyData
key
;
register
int
num
;
register
Oid
*
sp
;
if
(
oidArray
==
NULL
)
{
result
=
(
text
*
)
palloc
(
VARHDRSZ
);
VARSIZE
(
result
)
=
0
;
return
(
result
);
}
result
=
(
text
*
)
palloc
(
NAMEDATALEN
*
8
+
8
+
VARHDRSZ
);
*
VARDATA
(
result
)
=
'\0'
;
type
=
heap_openr
(
TypeRelationName
);
if
(
!
RelationIsValid
(
type
))
{
elog
(
WARN
,
"int8typeout: could not open %s"
,
TypeRelationName
);
return
(
0
);
}
sp
=
*
oidArray
;
for
(
num
=
8
;
num
!=
0
;
num
--
,
sp
++
)
{
if
(
*
sp
!=
InvalidOid
)
{
ScanKeyEntryInitialize
(
&
key
,
(
bits16
)
0
,
(
AttrNumber
)
ObjectIdAttributeNumber
,
(
RegProcedure
)
F_INT4EQ
,
(
Datum
)
*
sp
);
typescan
=
heap_beginscan
(
type
,
0
,
NowTimeQual
,
1
,
&
key
);
if
(
!
HeapScanIsValid
(
typescan
))
{
heap_close
(
type
);
elog
(
WARN
,
"int8typeout: could not being scan of %s"
,
TypeRelationName
);
return
(
0
);
}
typetup
=
heap_getnext
(
typescan
,
0
,
(
Buffer
*
)
NULL
);
if
(
HeapTupleIsValid
(
typetup
))
{
char
*
s
;
bool
isnull
;
s
=
(
char
*
)
heap_getattr
(
typetup
,
InvalidBuffer
,
1
,
RelationGetTupleDescriptor
(
type
),
&
isnull
);
if
(
!
isnull
)
{
StrNCpy
(
VARDATA
(
result
)
+
strlen
(
VARDATA
(
result
)),
s
,
16
);
strcat
(
VARDATA
(
result
),
" "
);
}
else
elog
(
FATAL
,
"int8typeout: null procedure %d"
,
*
sp
);
/* FALLTHROUGH */
}
heap_endscan
(
typescan
);
}
}
heap_close
(
type
);
VARSIZE
(
result
)
=
strlen
(
VARDATA
(
result
))
+
VARHDRSZ
;
return
(
result
);
}
/*****************************************************************************
/*****************************************************************************
* PUBLIC ROUTINES *
* PUBLIC ROUTINES *
...
...
src/bin/psql/psql.c
View file @
4e9df155
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.10
5 1997/11/14 21:37:41
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.10
6 1997/11/15 16:32:03
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -219,6 +219,7 @@ slashUsage(PsqlSettings *pset)
...
@@ -219,6 +219,7 @@ slashUsage(PsqlSettings *pset)
fprintf
(
fout
,
"
\\
d [<table>] -- list tables and indices, columns in <table>, or * for all
\n
"
);
fprintf
(
fout
,
"
\\
d [<table>] -- list tables and indices, columns in <table>, or * for all
\n
"
);
fprintf
(
fout
,
"
\\
da -- list aggregates
\n
"
);
fprintf
(
fout
,
"
\\
da -- list aggregates
\n
"
);
fprintf
(
fout
,
"
\\
dd [<object>]- list comment for table, field, type, function, or operator.
\n
"
);
fprintf
(
fout
,
"
\\
dd [<object>]- list comment for table, field, type, function, or operator.
\n
"
);
fprintf
(
fout
,
"
\\
df -- list functions
\n
"
);
fprintf
(
fout
,
"
\\
di -- list only indices
\n
"
);
fprintf
(
fout
,
"
\\
di -- list only indices
\n
"
);
fprintf
(
fout
,
"
\\
do -- list operators
\n
"
);
fprintf
(
fout
,
"
\\
do -- list operators
\n
"
);
fprintf
(
fout
,
"
\\
ds -- list only sequences
\n
"
);
fprintf
(
fout
,
"
\\
ds -- list only sequences
\n
"
);
...
@@ -1691,6 +1692,20 @@ HandleSlashCmds(PsqlSettings *pset,
...
@@ -1691,6 +1692,20 @@ HandleSlashCmds(PsqlSettings *pset,
else
if
(
strncmp
(
cmd
,
"dd"
,
2
)
==
0
)
else
if
(
strncmp
(
cmd
,
"dd"
,
2
)
==
0
)
/* descriptions */
/* descriptions */
objectDescription
(
pset
,
optarg
+
1
,
NULL
);
objectDescription
(
pset
,
optarg
+
1
,
NULL
);
else
if
(
strncmp
(
cmd
,
"df"
,
2
)
==
0
)
/* functions/procedures */
/* we skip in/out funcs by excluding functions that take
some arguments, but have no types defined for those arguments */
SendQuery
(
&
success
,
pset
,
"\
SELECT p.proname as function, \
t.typname as return_type, \
oid8types(p.proargtypes) as arguments, \
obj_description(p.oid) \
FROM pg_proc p, pg_type t \
WHERE p.prorettype = t.oid and \
(pronargs = 0 or oid8types(p.proargtypes) != '') \
ORDER BY function;"
,
false
,
false
,
0
);
else
if
(
strncmp
(
cmd
,
"di"
,
2
)
==
0
)
else
if
(
strncmp
(
cmd
,
"di"
,
2
)
==
0
)
/* only indices */
/* only indices */
tableList
(
pset
,
false
,
'i'
);
tableList
(
pset
,
false
,
'i'
);
...
...
src/include/catalog/pg_proc.h
View file @
4e9df155
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: pg_proc.h,v 1.3
5 1997/11/14 21:37:54
momjian Exp $
* $Id: pg_proc.h,v 1.3
6 1997/11/15 16:32:09
momjian Exp $
*
*
* NOTES
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
* The script catalog/genbki.sh reads this file and generates .bki
...
@@ -1651,6 +1651,8 @@ DATA(insert OID = 1347 ( int4 PGUID 14 f t f 1 f 23 "25" 100 0 0 100 "sele
...
@@ -1651,6 +1651,8 @@ DATA(insert OID = 1347 ( int4 PGUID 14 f t f 1 f 23 "25" 100 0 0 100 "sele
DESCR
(
""
);
DESCR
(
""
);
DATA
(
insert
OID
=
1348
(
obj_description
PGUID
14
f
t
f
1
f
25
"26"
100
0
0
100
"select description from pg_description where objoid = $1"
-
));
DATA
(
insert
OID
=
1348
(
obj_description
PGUID
14
f
t
f
1
f
25
"26"
100
0
0
100
"select description from pg_description where objoid = $1"
-
));
DESCR
(
""
);
DESCR
(
""
);
DATA
(
insert
OID
=
1349
(
oid8types
PGUID
11
f
t
f
1
f
25
"30"
100
0
0
100
foo
bar
));
DESCR
(
""
);
DATA
(
insert
OID
=
1350
(
datetime
PGUID
14
f
t
f
1
f
1184
"1184"
100
0
0
100
"select $1"
-
));
DATA
(
insert
OID
=
1350
(
datetime
PGUID
14
f
t
f
1
f
1184
"1184"
100
0
0
100
"select $1"
-
));
DESCR
(
""
);
DESCR
(
""
);
...
...
src/include/utils/builtins.h
View file @
4e9df155
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: builtins.h,v 1.
29 1997/10/30 16:42:50 thomas
Exp $
* $Id: builtins.h,v 1.
30 1997/11/15 16:32:15 momjian
Exp $
*
*
* NOTES
* NOTES
* This should normally only be included by fmgr.h.
* This should normally only be included by fmgr.h.
...
@@ -410,6 +410,7 @@ extern bool texticregexne(struct varlena * s, struct varlena * p);
...
@@ -410,6 +410,7 @@ extern bool texticregexne(struct varlena * s, struct varlena * p);
/* regproc.c */
/* regproc.c */
extern
int32
regprocin
(
char
*
proname
);
extern
int32
regprocin
(
char
*
proname
);
extern
char
*
regprocout
(
RegProcedure
proid
);
extern
char
*
regprocout
(
RegProcedure
proid
);
extern
text
*
oid8types
(
Oid
(
*
oidArray
)[]);
extern
Oid
regproctooid
(
RegProcedure
rp
);
extern
Oid
regproctooid
(
RegProcedure
rp
);
/* define macro to replace mixed-case function call - tgl 97/04/27 */
/* define macro to replace mixed-case function call - tgl 97/04/27 */
...
...
src/man/psql.1
View file @
4e9df155
.\" This is -*-nroff-*-
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.1
6 1997/11/15 02:47:23 thomas
Exp $
.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.1
7 1997/11/15 16:32:25 momjian
Exp $
.TH PSQL UNIX 1/20/96 PostgreSQL PostgreSQL
.TH PSQL UNIX 1/20/96 PostgreSQL PostgreSQL
.SH NAME
.SH NAME
psql \(em run the interactive query front-end
psql \(em run the interactive query front-end
...
@@ -296,6 +296,8 @@ list all tables and column information for each tables.
...
@@ -296,6 +296,8 @@ list all tables and column information for each tables.
List aggregates.
List aggregates.
.IP "\edd object"
.IP "\edd object"
List the description of the table, table.column, type, operator, or aggregate.
List the description of the table, table.column, type, operator, or aggregate.
.IP "\edf"
List functions.
.IP "\edi"
.IP "\edi"
List only indexes.
List only indexes.
.IP "\edo"
.IP "\edo"
...
...
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