pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rodrigo De León <rdeleonp@gmail.com>
To: pgsql-sql@postgresql.org
Cc: Collin Peters <cadiolis@gmail.com>
Subject: Re: Convert serial column to regular integer
Date: Fri, 11 May 2007 11:36:25 -0500
Message-ID: <a55915760705110936j1ee5bb67oe366c9161c92fc33@mail.gmail.com> (raw)
In-Reply-To: <df01c91b0705110924k45362880rdcc01db1cae3024f@mail.gmail.com>
References: <df01c91b0705110924k45362880rdcc01db1cae3024f@mail.gmail.com>

On 5/11/07, Collin Peters <cadiolis@gmail.com> 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;



view thread (4+ messages)  latest in thread

Message-ID: <a55915760705110936j1ee5bb67oe366c9161c92fc33@mail.gmail.com>
Permalink:  ../a55915760705110936j1ee5bb67oe366c9161c92fc33@mail.gmail.com/
Also on:    postgresql.org/message-id/a55915760705110936j1ee5bb67oe366c9161c92fc33@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rdeleonp@gmail.com, cadiolis@gmail.com
  Subject: Re: Convert serial column to regular integer
  In-Reply-To: <a55915760705110936j1ee5bb67oe366c9161c92fc33@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox