I'm continuing to create a primary keyless table initially. Then I add a id
field of serial type and try to create the constraint for the Primary Key (PK):
create table macaco(
nome varchar(50),
idade integer
);
--adicionando o id do tipo serial
ALTER TABLE "macaco" ADD COLUMN id SERIAL;
--criando a primary key
ALTER TABLE "macaco" ADD PRIMARY KEY (id);
As I do above, it creates the PK with the name of macaco_pkey
.
So far so good. But what if I want to create the constraint with the name id_macaco_pk
, what should I do?