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
37009811
Commit
37009811
authored
Sep 14, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new make_oidjoin_check utility and template1_check.sql. Fix some
pg_operator problems.
parent
f1bcb171
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
223 additions
and
7 deletions
+223
-7
contrib/findoidjoins/Makefile
contrib/findoidjoins/Makefile
+1
-1
contrib/findoidjoins/README
contrib/findoidjoins/README
+1
-1
contrib/findoidjoins/findoidjoins.c
contrib/findoidjoins/findoidjoins.c
+2
-0
contrib/findoidjoins/make_oidjoins_check
contrib/findoidjoins/make_oidjoins_check
+35
-0
src/include/catalog/pg_operator.h
src/include/catalog/pg_operator.h
+5
-5
src/include/catalog/template1_check.sql
src/include/catalog/template1_check.sql
+179
-0
No files found.
contrib/findoidjoins/Makefile
View file @
37009811
...
...
@@ -2,7 +2,7 @@
# Makefile, requires pgsql/contrib/pginterface
#
#
PGINTERFACE
=
pginterface.o
halt.o
# these have to be in your library search path
PGINTERFACE
=
../pginterface/pginterface.o ../pginterface/
halt.o
# these have to be in your library search path
TARGET
=
findoidjoins
CFLAGS
=
-g
-Wall
-I
.
-I
../../src/interfaces/libpq
-I
/usr/local/pgsql/include
LDFLAGS
=
-L
/usr/local/pgsql/lib
-lpq
...
...
contrib/findoidjoins/README
View file @
37009811
...
...
@@ -35,6 +35,7 @@ Join pg_am.ambuild => pg_proc.oid
Join pg_amop.amopid => pg_am.oid
Join pg_amop.amopclaid => pg_opclass.oid
Join pg_amop.amopopr => pg_operator.oid
Join pg_amop.amopopr => pg_proc.oid
Join pg_amop.amopselect => pg_proc.oid
Join pg_amop.amopnpages => pg_proc.oid
Join pg_amproc.amid => pg_am.oid
...
...
@@ -51,7 +52,6 @@ Join pg_description.objoid => pg_proc.oid
Join pg_description.objoid => pg_type.oid
Join pg_index.indexrelid => pg_class.oid
Join pg_index.indrelid => pg_class.oid
Join pg_index.indproc => pg_proc.oid
Join pg_opclass.opcdeftype => pg_type.oid
Join pg_operator.oprleft => pg_type.oid
Join pg_operator.oprright => pg_type.oid
...
...
contrib/findoidjoins/findoidjoins.c
View file @
37009811
...
...
@@ -35,6 +35,7 @@ main(int argc, char **argv)
FROM pg_class c, pg_attribute a, pg_type t \
WHERE a.attnum > 0 AND \
relkind = 'r' AND \
relhasrules = 'f' AND \
(typname = 'oid' OR \
typname = 'regproc') AND \
a.attrelid = c.oid AND \
...
...
@@ -49,6 +50,7 @@ main(int argc, char **argv)
SELECT relname \
FROM pg_class c \
WHERE relkind = 'r' AND \
relhasrules = 'f' AND \
relname != 'pg_user' \
ORDER BY 1; \
"
);
...
...
contrib/findoidjoins/make_oidjoins_check
0 → 100755
View file @
37009811
:
# You first run findoidjoins on the template1 database, and send that
# output into this file to generate a list of SQL statements.
trap "rm -f /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
cat "$@" >/tmp/$$
cat /tmp/$$ | cut -d' ' -f2 | sort | uniq -d >/tmp/$$a
cat /tmp/$$ | while read LINE
do
set -- $LINE
grep "$2" /tmp/$$a >/dev/null 2>&1 || echo $LINE
done >/tmp/$$b
cat /tmp/$$b |
awk -F'[ \.]' '\
BEGIN \
{
printf "\
--\n\
-- This is created by pgsql/contrib/findoidjoins/make_oidjoin_check\n\
--\n";
}
{
printf "\
SELECT oid, %s.%s \n\
FROM %s \n\
WHERE %s%s.%s%s NOT IN (SELECT oid FROM %s) AND \n\
%s%s.%s%s != 0;\n", $2, $3, $2,
($5 == "pg_proc") ? "RegprocToOid(" : "",
$2, $3,
($5 == "pg_proc") ? ")" : "",
$5,
($5 == "pg_proc") ? "RegprocToOid(" : "",
$2, $3,
($5 == "pg_proc") ? ")" : "";
}'
src/include/catalog/pg_operator.h
View file @
37009811
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_operator.h,v 1.3
7 1998/09/13 14:29:06 thomas
Exp $
* $Id: pg_operator.h,v 1.3
8 1998/09/14 01:14:48 momjian
Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -200,8 +200,8 @@ DATA(insert OID = 525 ( ">=" PGUID 0 b t f 23 23 16 523 97 0 0 int4ge
DATA
(
insert
OID
=
526
(
"*"
PGUID
0
b
t
f
21
21
21
526
0
0
0
int2mul
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
527
(
"/"
PGUID
0
b
t
f
21
21
21
0
0
0
0
int2div
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
528
(
"/"
PGUID
0
b
t
f
23
23
23
0
0
0
0
int4div
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
529
(
"%"
PGUID
0
b
t
f
21
21
21
6
0
0
0
int2mod
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
530
(
"%"
PGUID
0
b
t
f
23
23
23
6
0
0
0
int4mod
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
529
(
"%"
PGUID
0
b
t
f
21
21
21
0
0
0
0
int2mod
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
530
(
"%"
PGUID
0
b
t
f
23
23
23
0
0
0
0
int4mod
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
531
(
"<>"
PGUID
0
b
t
f
25
25
16
531
98
0
0
textne
neqsel
neqjoinsel
));
DATA
(
insert
OID
=
532
(
"="
PGUID
0
b
t
t
21
23
16
533
538
95
97
int24eq
eqsel
eqjoinsel
));
DATA
(
insert
OID
=
533
(
"="
PGUID
0
b
t
t
23
21
16
532
539
97
95
int42eq
eqsel
eqjoinsel
));
...
...
@@ -219,8 +219,8 @@ DATA(insert OID = 544 ( "*" PGUID 0 b t f 21 23 23 545 0 0 0 int24mul
DATA
(
insert
OID
=
545
(
"*"
PGUID
0
b
t
f
23
21
23
544
0
0
0
int42mul
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
546
(
"/"
PGUID
0
b
t
f
21
23
23
0
0
0
0
int24div
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
547
(
"/"
PGUID
0
b
t
f
23
21
23
0
0
0
0
int42div
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
548
(
"%"
PGUID
0
b
t
f
21
23
23
6
0
0
0
int24mod
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
549
(
"%"
PGUID
0
b
t
f
23
21
23
6
0
0
0
int42mod
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
548
(
"%"
PGUID
0
b
t
f
21
23
23
0
0
0
0
int24mod
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
549
(
"%"
PGUID
0
b
t
f
23
21
23
0
0
0
0
int42mod
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
550
(
"+"
PGUID
0
b
t
f
21
21
21
550
0
0
0
int2pl
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
551
(
"+"
PGUID
0
b
t
f
23
23
23
551
0
0
0
int4pl
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
552
(
"+"
PGUID
0
b
t
f
21
23
23
553
0
0
0
int24pl
intltsel
intltjoinsel
));
...
...
src/include/catalog/template1_check.sql
0 → 100644
View file @
37009811
--
-- This is created by pgsql/contrib/findoidjoins/make_oidjoin_check
--
SELECT
oid
,
pg_aggregate
.
aggtransfn1
FROM
pg_aggregate
WHERE
RegprocToOid
(
pg_aggregate
.
aggtransfn1
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_aggregate
.
aggtransfn1
)
!=
0
;
SELECT
oid
,
pg_aggregate
.
aggtransfn2
FROM
pg_aggregate
WHERE
RegprocToOid
(
pg_aggregate
.
aggtransfn2
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_aggregate
.
aggtransfn2
)
!=
0
;
SELECT
oid
,
pg_aggregate
.
aggfinalfn
FROM
pg_aggregate
WHERE
RegprocToOid
(
pg_aggregate
.
aggfinalfn
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_aggregate
.
aggfinalfn
)
!=
0
;
SELECT
oid
,
pg_aggregate
.
aggtranstype2
FROM
pg_aggregate
WHERE
pg_aggregate
.
aggtranstype2
NOT
IN
(
SELECT
oid
FROM
pg_type
)
AND
pg_aggregate
.
aggtranstype2
!=
0
;
SELECT
oid
,
pg_am
.
amgettuple
FROM
pg_am
WHERE
RegprocToOid
(
pg_am
.
amgettuple
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_am
.
amgettuple
)
!=
0
;
SELECT
oid
,
pg_am
.
aminsert
FROM
pg_am
WHERE
RegprocToOid
(
pg_am
.
aminsert
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_am
.
aminsert
)
!=
0
;
SELECT
oid
,
pg_am
.
amdelete
FROM
pg_am
WHERE
RegprocToOid
(
pg_am
.
amdelete
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_am
.
amdelete
)
!=
0
;
SELECT
oid
,
pg_am
.
ambeginscan
FROM
pg_am
WHERE
RegprocToOid
(
pg_am
.
ambeginscan
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_am
.
ambeginscan
)
!=
0
;
SELECT
oid
,
pg_am
.
amrescan
FROM
pg_am
WHERE
RegprocToOid
(
pg_am
.
amrescan
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_am
.
amrescan
)
!=
0
;
SELECT
oid
,
pg_am
.
amendscan
FROM
pg_am
WHERE
RegprocToOid
(
pg_am
.
amendscan
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_am
.
amendscan
)
!=
0
;
SELECT
oid
,
pg_am
.
ammarkpos
FROM
pg_am
WHERE
RegprocToOid
(
pg_am
.
ammarkpos
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_am
.
ammarkpos
)
!=
0
;
SELECT
oid
,
pg_am
.
amrestrpos
FROM
pg_am
WHERE
RegprocToOid
(
pg_am
.
amrestrpos
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_am
.
amrestrpos
)
!=
0
;
SELECT
oid
,
pg_am
.
ambuild
FROM
pg_am
WHERE
RegprocToOid
(
pg_am
.
ambuild
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_am
.
ambuild
)
!=
0
;
SELECT
oid
,
pg_amop
.
amopid
FROM
pg_amop
WHERE
pg_amop
.
amopid
NOT
IN
(
SELECT
oid
FROM
pg_am
)
AND
pg_amop
.
amopid
!=
0
;
SELECT
oid
,
pg_amop
.
amopclaid
FROM
pg_amop
WHERE
pg_amop
.
amopclaid
NOT
IN
(
SELECT
oid
FROM
pg_opclass
)
AND
pg_amop
.
amopclaid
!=
0
;
SELECT
oid
,
pg_amop
.
amopselect
FROM
pg_amop
WHERE
RegprocToOid
(
pg_amop
.
amopselect
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_amop
.
amopselect
)
!=
0
;
SELECT
oid
,
pg_amop
.
amopnpages
FROM
pg_amop
WHERE
RegprocToOid
(
pg_amop
.
amopnpages
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_amop
.
amopnpages
)
!=
0
;
SELECT
oid
,
pg_amproc
.
amid
FROM
pg_amproc
WHERE
pg_amproc
.
amid
NOT
IN
(
SELECT
oid
FROM
pg_am
)
AND
pg_amproc
.
amid
!=
0
;
SELECT
oid
,
pg_attribute
.
attrelid
FROM
pg_attribute
WHERE
pg_attribute
.
attrelid
NOT
IN
(
SELECT
oid
FROM
pg_class
)
AND
pg_attribute
.
attrelid
!=
0
;
SELECT
oid
,
pg_attribute
.
atttypid
FROM
pg_attribute
WHERE
pg_attribute
.
atttypid
NOT
IN
(
SELECT
oid
FROM
pg_type
)
AND
pg_attribute
.
atttypid
!=
0
;
SELECT
oid
,
pg_class
.
reltype
FROM
pg_class
WHERE
pg_class
.
reltype
NOT
IN
(
SELECT
oid
FROM
pg_type
)
AND
pg_class
.
reltype
!=
0
;
SELECT
oid
,
pg_class
.
relam
FROM
pg_class
WHERE
pg_class
.
relam
NOT
IN
(
SELECT
oid
FROM
pg_am
)
AND
pg_class
.
relam
!=
0
;
SELECT
oid
,
pg_index
.
indexrelid
FROM
pg_index
WHERE
pg_index
.
indexrelid
NOT
IN
(
SELECT
oid
FROM
pg_class
)
AND
pg_index
.
indexrelid
!=
0
;
SELECT
oid
,
pg_index
.
indrelid
FROM
pg_index
WHERE
pg_index
.
indrelid
NOT
IN
(
SELECT
oid
FROM
pg_class
)
AND
pg_index
.
indrelid
!=
0
;
SELECT
oid
,
pg_opclass
.
opcdeftype
FROM
pg_opclass
WHERE
pg_opclass
.
opcdeftype
NOT
IN
(
SELECT
oid
FROM
pg_type
)
AND
pg_opclass
.
opcdeftype
!=
0
;
SELECT
oid
,
pg_operator
.
oprleft
FROM
pg_operator
WHERE
pg_operator
.
oprleft
NOT
IN
(
SELECT
oid
FROM
pg_type
)
AND
pg_operator
.
oprleft
!=
0
;
SELECT
oid
,
pg_operator
.
oprright
FROM
pg_operator
WHERE
pg_operator
.
oprright
NOT
IN
(
SELECT
oid
FROM
pg_type
)
AND
pg_operator
.
oprright
!=
0
;
SELECT
oid
,
pg_operator
.
oprresult
FROM
pg_operator
WHERE
pg_operator
.
oprresult
NOT
IN
(
SELECT
oid
FROM
pg_type
)
AND
pg_operator
.
oprresult
!=
0
;
SELECT
oid
,
pg_operator
.
oprcom
FROM
pg_operator
WHERE
pg_operator
.
oprcom
NOT
IN
(
SELECT
oid
FROM
pg_operator
)
AND
pg_operator
.
oprcom
!=
0
;
SELECT
oid
,
pg_operator
.
oprnegate
FROM
pg_operator
WHERE
pg_operator
.
oprnegate
NOT
IN
(
SELECT
oid
FROM
pg_operator
)
AND
pg_operator
.
oprnegate
!=
0
;
SELECT
oid
,
pg_operator
.
oprlsortop
FROM
pg_operator
WHERE
pg_operator
.
oprlsortop
NOT
IN
(
SELECT
oid
FROM
pg_operator
)
AND
pg_operator
.
oprlsortop
!=
0
;
SELECT
oid
,
pg_operator
.
oprrsortop
FROM
pg_operator
WHERE
pg_operator
.
oprrsortop
NOT
IN
(
SELECT
oid
FROM
pg_operator
)
AND
pg_operator
.
oprrsortop
!=
0
;
SELECT
oid
,
pg_operator
.
oprcode
FROM
pg_operator
WHERE
RegprocToOid
(
pg_operator
.
oprcode
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_operator
.
oprcode
)
!=
0
;
SELECT
oid
,
pg_operator
.
oprrest
FROM
pg_operator
WHERE
RegprocToOid
(
pg_operator
.
oprrest
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_operator
.
oprrest
)
!=
0
;
SELECT
oid
,
pg_operator
.
oprjoin
FROM
pg_operator
WHERE
RegprocToOid
(
pg_operator
.
oprjoin
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_operator
.
oprjoin
)
!=
0
;
SELECT
oid
,
pg_parg
.
partype
FROM
pg_parg
WHERE
pg_parg
.
partype
NOT
IN
(
SELECT
oid
FROM
pg_type
)
AND
pg_parg
.
partype
!=
0
;
SELECT
oid
,
pg_proc
.
prolang
FROM
pg_proc
WHERE
pg_proc
.
prolang
NOT
IN
(
SELECT
oid
FROM
pg_language
)
AND
pg_proc
.
prolang
!=
0
;
SELECT
oid
,
pg_proc
.
prorettype
FROM
pg_proc
WHERE
pg_proc
.
prorettype
NOT
IN
(
SELECT
oid
FROM
pg_type
)
AND
pg_proc
.
prorettype
!=
0
;
SELECT
oid
,
pg_rewrite
.
ev_class
FROM
pg_rewrite
WHERE
pg_rewrite
.
ev_class
NOT
IN
(
SELECT
oid
FROM
pg_class
)
AND
pg_rewrite
.
ev_class
!=
0
;
SELECT
oid
,
pg_type
.
typrelid
FROM
pg_type
WHERE
pg_type
.
typrelid
NOT
IN
(
SELECT
oid
FROM
pg_class
)
AND
pg_type
.
typrelid
!=
0
;
SELECT
oid
,
pg_type
.
typinput
FROM
pg_type
WHERE
RegprocToOid
(
pg_type
.
typinput
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_type
.
typinput
)
!=
0
;
SELECT
oid
,
pg_type
.
typoutput
FROM
pg_type
WHERE
RegprocToOid
(
pg_type
.
typoutput
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_type
.
typoutput
)
!=
0
;
SELECT
oid
,
pg_type
.
typreceive
FROM
pg_type
WHERE
RegprocToOid
(
pg_type
.
typreceive
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_type
.
typreceive
)
!=
0
;
SELECT
oid
,
pg_type
.
typsend
FROM
pg_type
WHERE
RegprocToOid
(
pg_type
.
typsend
)
NOT
IN
(
SELECT
oid
FROM
pg_proc
)
AND
RegprocToOid
(
pg_type
.
typsend
)
!=
0
;
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