Weirdess when altering serial column type

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Weirdess when altering serial column type
Date: 2005-04-19 05:13:22
Message-ID: 42649372.50004@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Should that sequence really stick around as an integer, numeric and text
field???

test=# create table test (a serial);
NOTICE: CREATE TABLE will create implicit sequence "test_a_seq" for
serial column "test.a"
NOTICE: CREATE TABLE will create implicit sequence "test_a_seq" for
serial column "test.a"
CREATE TABLE
test=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------------------------------------------------
a | integer | not null default nextval('public.test_a_seq'::text)

test=# alter table test alter a type integer;
ALTER TABLE
test=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------------------------------------------------
a | integer | not null default nextval('public.test_a_seq'::text)

test=# alter table test alter a type numeric;
ALTER TABLE
test=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------------------------------------------------
a | numeric | not null default nextval('public.test_a_seq'::text)

test=# alter table test alter a type text;
ALTER TABLE
test=# \d test
Table "public.test"
Column | Type | Modifiers
--------+------+-----------------------------------------------------
a | text | not null default nextval('public.test_a_seq'::text)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-04-19 06:07:02 Re: Weirdess when altering serial column type
Previous Message Oleg Bartunov 2005-04-19 05:07:35 Re: Problem with PITR recovery