sql - Issue while ALTER COLUMN in Postgresql -


this question has answer here:

i have table id , name id primary key bigint datatype. want alter column, id primary key auto incremented value.

my table:

 create table test(   testid bigint not null,   testname character varying(255),    constraint test_pkey primary key (testid) ); 

alter query:

alter table test alter column testid bigserial primary key; 

after executing query i'm getting following error,

error:  syntax error @ or near "bigserial" line 1: alter table test alter column testid bigserial p...                                                          ^  ********** error **********  error: syntax error @ or near "bigserial" sql state: 42601 character: 50 

you can try command

alter table your_table alter column key_column type bigserial primary key; 

i hope helpful you


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -