From: | Jeff Frost <jeff(at)pgexperts(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #9606: pg_class relhaspkey column not updated on removal of primary key |
Date: | 2014-03-18 00:48:36 |
Message-ID: | D0A66CF0-AD34-4647-9C05-1317ECFB97DC@pgexperts.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Mar 17, 2014, at 12:01 PM, Jeff Frost <jeff(at)pgexperts(dot)com> wrote:
>
> On Mar 17, 2014, at 11:59 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>
> Sure enough, you're right!
>
> pkey_test=# select relname, relhaspkey FROM pg_class where relname = 'foo';
> relname | relhaspkey
> ---------+------------
> foo | t
> (1 row)
>
> pkey_test=# vacuum foo;
> VACUUM
> pkey_test=# select relname, relhaspkey FROM pg_class where relname = 'foo';
> relname | relhaspkey
> ---------+------------
> foo | f
> (1 row)
>
> Thanks, Tom, i had completely forgotten about that!
Interestingly, on 9.1.11, I have a table where the pkey was added after the fact, then dropped, but it still shows as relhaspkey even though I manually vacuumed it:
\d output way after the pkey and associated column were dropped:
Table "public.resources"
Column | Type | Modifiers
------------+---------+-----------
id | bigint |
project_id | bigint |
name | text |
source_uid | integer |
old_id | bigint |
new_id | bigint |
Indexes:
"index_resources_on_id" btree (id)
"index_resources_on_project_id" btree (project_id)
select relname, relhaspkey FROM pg_class where relname = 'resources';
relname | relhaspkey
-----------+------------
resources | t
(1 row)
VACUUM resources;
select relname, relhaspkey FROM pg_class where relname = 'resources';
relname | relhaspkey
-----------+------------
resources | t
(1 row)
Unfortunately, I can't seem to reproduce that behavior with a test case.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-03-18 01:18:28 | Re: pg 9.3 exists subselect with limit brakes query plan |
Previous Message | Kószó József | 2014-03-18 00:36:57 | pg 9.3 exists subselect with limit brakes query plan |