mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Make OIDs optional, per discussions in pghackers. WITH OIDS is still the
default, but OIDS are removed from many system catalogs that don't need them. Some interesting side effects: TOAST pointers are 20 bytes not 32 now; pg_description has a three-column key instead of one. Bugs fixed in passing: BINARY cursors work again; pg_class.relhaspkey has some usefulness; pg_dump dumps comments on indexes, rules, and triggers in a valid order. initdb forced.
This commit is contained in:
@ -38,7 +38,6 @@ 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 \
|
||||
@ -52,8 +51,7 @@ main(int argc, char **argv)
|
||||
DECLARE c_relations BINARY CURSOR FOR \
|
||||
SELECT relname \
|
||||
FROM pg_class c \
|
||||
WHERE relkind = 'r' AND \
|
||||
relhasrules = 'f' \
|
||||
WHERE relkind = 'r' AND relhasoids \
|
||||
ORDER BY 1; \
|
||||
");
|
||||
doquery("FETCH ALL IN c_relations");
|
||||
@ -71,14 +69,14 @@ main(int argc, char **argv)
|
||||
sprintf(query, "\
|
||||
DECLARE c_matches BINARY CURSOR FOR \
|
||||
SELECT count(*) \
|
||||
FROM %s t1, %s t2 \
|
||||
WHERE t1.%s = t2.oid ", relname, relname2, attname);
|
||||
FROM \"%s\" t1, \"%s\" t2 \
|
||||
WHERE t1.\"%s\" = t2.oid ", relname, relname2, attname);
|
||||
else
|
||||
sprintf(query, "\
|
||||
DECLARE c_matches BINARY CURSOR FOR \
|
||||
SELECT count(*) \
|
||||
FROM %s t1, %s t2 \
|
||||
WHERE RegprocToOid(t1.%s) = t2.oid ", relname, relname2, attname);
|
||||
FROM \"%s\" t1, \"%s\" t2 \
|
||||
WHERE RegprocToOid(t1.\"%s\") = t2.oid ", relname, relname2, attname);
|
||||
|
||||
doquery(query);
|
||||
doquery("FETCH ALL IN c_matches");
|
||||
|
Reference in New Issue
Block a user