Link to home
Start Free TrialLog in
Avatar of dimensionav
dimensionavFlag for Mexico

asked on

Create postgresql sequence for database ids

Hi!

We imported a MySQL database and, since in postgre there isn't Autoincrement options, we need to create a serial.

The thing is, the current exported id's doesn't allow us to change its type from int to a serial, instead of  that, Postgresql is asking to create a sequence and set the default value as the nextval of that sequence

Is there any more efficient way to do it?

Regards!
Avatar of Doug Walton
Doug Walton
Flag of United States of America image

As far as I know, that's the only way to do it which is kind of annoying.

If you have to do this a ton of times you could try creating a procedure that would take a table and column name as parameters that would do it for you.
ASKER CERTIFIED SOLUTION
Avatar of earth man2
earth man2
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial