Porting from MySQL to postgreSQL. Question RE: Sequence Dependencies

Поиск
Список
Период
Сортировка
От Robert Starr
Тема Porting from MySQL to postgreSQL. Question RE: Sequence Dependencies
Дата
Msg-id 46E8AD82.6000109@surrenderdorothy.com.au
обсуждение исходный текст
Ответы Re: Porting from MySQL to postgreSQL. Question RE: Sequence Dependencies  (Charlie Clark <charlie@begeistert.org>)
Список 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


В списке pgadmin-support по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: pgAdmin III v1.8.0 Beta 5 released
Следующее
От: Robert Starr
Дата:
Сообщение: ERROR: duplicate key violates unique constraint "client_alerts_PK"