Received: from ece.rice.edu (ece.rice.edu [128.42.4.34]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5TI3Va82760 for ; Fri, 29 Jun 2001 14:03:31 -0400 (EDT) (envelope-from reedstrm@rice.edu) Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154]) by ece.rice.edu (Postfix) with ESMTP id 0DB5F68A17; Fri, 29 Jun 2001 13:03:29 -0500 (CDT) Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.22 #1 (Debian)) id 15G2bh-0004v0-00; Fri, 29 Jun 2001 13:03:05 -0500 Date: Fri, 29 Jun 2001 13:03:05 -0500 From: "Ross J. Reedstrom" To: Kostis Mentzelos Cc: pgsql-admin@postgresql.org Subject: Re: Re: rename a table Message-ID: <20010629130305.D17874@rice.edu> Mail-Followup-To: "Ross J. Reedstrom" , Kostis Mentzelos , pgsql-admin@postgresql.org References: <3B31AB47.2A46172B@ematic.com> <3B3659CA.BAADC592@ematic.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3B3659CA.BAADC592@ematic.com> User-Agent: Mutt/1.3.18i X-Archive-Number: 200106/179 X-Sequence-Number: 1751 On Mon, Jun 25, 2001 at 12:21:14AM +0300, Kostis Mentzelos wrote: > In order to rename the table safely, I want to REVOKE INSERT on that > table. > > But there is a problem because if there are users connected to > database then REVOKE command wait until they disconnect. > How can I found out who are connected to database? Can I kill them? > > -- > > I found out that SERIAL type creating a unique index. (RTFM) > I also found out that using ALTER TABLE x RENAME TO y I can rename > primary > keys and indexes. Be careful combining these two: the serial type creates a sequence as well as a unique index, the name of which is hardcoded into the DEFAULT clause for the table. Rename the table, and you'll need to leave the sequence alone, since the DEFAULT clause can't be dynamically changed (yet). Ross