From: | Dave Page <dpage(at)pgadmin(dot)org> |
---|---|
To: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
Cc: | pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug or not? |
Date: | 2009-03-04 09:30:33 |
Message-ID: | 937d27e10903040130v5176d810s1cb880de2c2d22d4@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-hackers |
On Wed, Mar 4, 2009 at 8:46 AM, Guillaume Lelarge
<guillaume(at)lelarge(dot)info> wrote:
> Hi,
>
> I received a bug report some days (arg... months) before. I tried to
> work on it sometime ago and again today, but I don't find a way to be
> sure it is an actual bug in pgAdmin or something we can't do much right now.
>
> Here are some psql commands to build a database that shows this issue:
>
> CREATE DATABASE ioguix;
> \c ioguix
> CREATE TABLE t1 (id serial);
> CREATE TABLE t2 (LIKE t1 INCLUDING DEFAULTS);
>
> Now, launch pgAdmin3, click on the t2 table and then on the Dependents
> tab. There's nothing in the listview. I assumed I would see the
> t1_id_seq sequence, as showed by the SQL:
>
> CREATE TABLE t2
> (
> id integer NOT NULL DEFAULT nextval('t1_id_seq'::regclass)
> )
> WITH (
> OIDS=FALSE
> );
>
> I'm not sure PostgreSQL keeps this information somewhere (at least not
> on the pg_depends catalog) but it sure is able to find it:
>
> guillaume(at)laptop$ psql -q ioguix
> ioguix=# drop table t1;
> NOTICE: default for table t2 column id depends on sequence t1_id_seq
> ERROR: cannot drop table t1 because other objects depend on it
> ASTUCE : Use DROP ... CASCADE to drop the dependent objects too.
There are dependencies in pg_depends between the pg_attrdef row and
the sequence and the pg_attrdef row and the table. Try:
select * from pg_depend where classid = 2604; -- the oid of pg_attrdef
It seems to me that it should be relatively easy to fix, by adding
pg_sttrdef to the queries in pgObject::ShowDependencies and
pgObject::ShowDependents such that type = 'r'. Need to be careful that
the existing dependency that is shown for t1 doesn't get duplicated.
--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2009-03-05 09:26:26 | Re: pgAdmin for Greenplum database? |
Previous Message | Guillaume Lelarge | 2009-03-04 08:46:18 | Bug or not? |