Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 38A0D9FBA6F for ; Fri, 11 May 2007 13:36:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 42377-07 for ; Fri, 11 May 2007 13:36:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.247]) by postgresql.org (Postfix) with ESMTP id 4CD949FB51F for ; Fri, 11 May 2007 13:36:26 -0300 (ADT) Received: by an-out-0708.google.com with SMTP id d17so249170and for ; Fri, 11 May 2007 09:36:25 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=m0SQTRURiZ1WAAiBqEF9djfMOp1bOjnFcAs+A5yw9QYU0IUxzsm2lWYnaGoDDuk3Sejx65twRgHpA5WdUI7XqiFYSiXU0wAziIt4cIimGjiz3lCOdgNIcg0J+XS6O21BZxkSBuoFeQFHyGVSu4bgB9lNS/wRVMRUN9AarI8TvO0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=AmDzXuLXhb1ricTRcbhsmqbcwY3zAwg599XDXlg/B9iSGBpWtKrVVvY/pNzcM5/7ZfhP58RYqP5nSbe224N3RYgAi1dJnIluvUCD3zQHUn4mHD8VJsV9iWagtDn0KJBTwhFjNNM5WUrnIs+KUbzAL5tqnwT2hgzH+D9Zx1kULgA= Received: by 10.100.40.17 with SMTP id n17mr2379093ann.1178901385601; Fri, 11 May 2007 09:36:25 -0700 (PDT) Received: by 10.100.154.9 with HTTP; Fri, 11 May 2007 09:36:25 -0700 (PDT) Message-ID: Date: Fri, 11 May 2007 11:36:25 -0500 From: "=?ISO-8859-1?Q?Rodrigo_De_Le=F3n?=" To: pgsql-sql@postgresql.org Subject: Re: Convert serial column to regular integer Cc: "Collin Peters" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/87 X-Sequence-Number: 28367 On 5/11/07, Collin Peters wrote: > I have a need to convert an incorrectly typed serial column to a > regular integer column. Basically this just involves removing the > sequence. I am able to successfully remove the default value (DROP > DEFAULT) (which seems to use nextval) and now pgadmin does show the > column as an integer, but I cannot remove the sequence as it says it > is still in use. If I look at the column in pgadmin the sequence > field is still filled in with the sequence but it is grayed out. Is > there any way to remove the sequence fully? > > Regards, > Collin CREATE TABLE dtab (i SERIAL); ALTER TABLE dtab ALTER COLUMN i DROP DEFAULT; ALTER SEQUENCE dtab_i_seq OWNED BY NONE; DROP SEQUENCE dtab_i_seq;