From: | "Rod Taylor" <rbt(at)zort(dot)ca> |
---|---|
To: | "Hackers List" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Dependencies |
Date: | 2002-03-07 04:24:09 |
Message-ID: | 066301c1c590$344871d0$b002000a@jester |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I'd like to confirm I'm doing this in an acceptable manner as running
through the dependency tree is kinda heavy -- then again how often do
you drop something?
Source patch (against 7.2 release) can be found at:
http://www.zort.ca/~rbt/patches/postgresql_dependencies/depend.patch
Tracking table pg_depend is similar to pg_description in regards to
applying an address to an object. It's quite simple to create and
delete dependencies between objects.
The bad part is that the depend...() functions rely on the name of
their 'class' (pg_class.relname) to align with those recorded in
catname.h. In order to figure out what the object is and how to deal
with it, the code is required to run through a large number of if /
elseif statements. Then the specific removal function is called; like
removeType(). I'd much prefer to use a switch statement which doesn't
appear to work with strings, so I'm looking for suggestions.
Otherwise those if / else combinations will have as many entries as
there are system tables -- well, a couple less.
A completed example on types is a part of the patch, simple output
below. System structures do not have entries in pg_depend yet, but
those will be done before submission of the patch.
template1=# create database d;
CREATE DATABASE
template1=# \c d
You are now connected to database d.
d=# select * from pg_depend;
classid | objid | objsubid | depclassid | depobjid | depobjsubid
---------+-------+----------+------------+----------+-------------
(0 rows)
d=# create type typ1 (input = int2in,output = int2out);
CREATE
d=# select * from pg_depend;
classid | objid | objsubid | depclassid | depobjid | depobjsubid
---------+-------+----------+------------+----------+-------------
1247 | 41155 | 0 | 1255 | 38 | 0
1247 | 41155 | 0 | 1255 | 39 | 0
1247 | 41155 | 0 | 1255 | 38 | 0
1247 | 41155 | 0 | 1255 | 39 | 0
1247 | 41156 | 0 | 1255 | 750 | 0
1247 | 41156 | 0 | 1255 | 751 | 0
1247 | 41156 | 0 | 1255 | 750 | 0
1247 | 41156 | 0 | 1255 | 751 | 0
(8 rows)
d=# drop type typ1;
DROP
d=# select * from pg_depend;
classid | objid | objsubid | depclassid | depobjid | depobjsubid
---------+-------+----------+------------+----------+-------------
(0 rows)
--
Rod Taylor
Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. You cannot imagine why you ever felt
otherwise.
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2002-03-07 04:26:54 | Re: Bad Build |
Previous Message | Bruce Momjian | 2002-03-07 04:09:59 | Re: Libpq support for precision and scale |