Olá pessoal, já resolvi fazendo dessa forma:
-- 1 - Creating the Sequence: CREATE SEQUENCE users_code_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1000; CACHE 1; -- 2 - Setting the DEFAULT ALTER TABLE public.users ALTER COLUMN code SET DEFAULT NEXTVAL('users_code_seq'); -- 3 - Setting the column as NOT NULL; ALTER TABLE public.users ALTER COLUMN code SET NOT NULL; -- 4 - Creating a CONSTRAINT UNIQUE ALTER TABLE public.users ADD CONSTRAINT uc_users_code UNIQUE("code"); Obrigado
_______________________________________________ pgbr-geral mailing list pgbr-geral@listas.postgresql.org.br https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral