Porting from MySQL to postgreSQL. Question RE: Sequence Dependencies

From: Robert Starr <rob(at)surrenderdorothy(dot)com(dot)au>
To: pgadmin-support(at)postgresql(dot)org
Subject: Porting from MySQL to postgreSQL. Question RE: Sequence Dependencies
Date: 2007-09-13 03:24:50
Message-ID: 46E8AD82.6000109@surrenderdorothy.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi all, this is my first post. I have a quick question, and if I have
it all wrong I apologise in advance, I'm still trying to get used to a
'real' SQL after moving away from MySQL.

I am using pgAdminIII and have created a table called 'clients' and
filled it with data. I then tried to edit the table so there would be a
primary key, and auto increment etc.
What I've noticed, is if I create a NEW column, and make it of type
'serial' then it automatically creates a sequence, but if I want to go
and edit a pre-existing column and change it from type 'integer' to type
'serial' I cannot.

That is fine, I added nextval('clients_id_seq'::regclass) to the Default
Value of my ID column, and I even added a sequence called
'clients_id_seq' but the thing is, there is no dependency between the
column and the sequence.

How can I go about linking the two? I'm a bit stuck :)

Any help would be really appreciated.

Rob

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Robert Starr 2007-09-13 03:52:54 ERROR: duplicate key violates unique constraint "client_alerts_PK"
Previous Message Dave Page 2007-09-12 14:14:56 pgAdmin III v1.8.0 Beta 5 released