ON CONFLICT ON CONSTRAINT fail postgresql INSERT INTO O_USER (ID, NAME, LASTNAME, EMAIL, USERNAME, PASSWD, DATE_REG, DATE_UPD, DATE_DEL, IS_DELETE, TIPO, FTP) 
VALUES (%s,%s,%s,%s,%s,%s,DEFAULT,NULL,NULL,%s,%s,%s) 
ON CONFLICT ON CONSTRAINT ux DO NOTHING;


ux constraint:

CREATE UNIQUE INDEX ux ON public.o_user USING btree (email,username);


but in multiple insert have this error:

psycopg2.IntegrityError: duplicate key value violates unique constraint "o_user_username_key"
DETAIL:  Key (username)=(jferraro) already exists.


what is the problem?

update add table information:

CREATE TABLE O_USER (
    ID          INTEGER         PRIMARY KEY,
    NAME        VARCHAR(30)     NOT NULL,
    LASTNAME    VARCHAR(30)     NOT NULL,
    EMAIL       VARCHAR(50)     NOT NULL UNIQUE,
    USERNAME    VARCHAR(30)     NOT NULL UNIQUE,
    PASSWD      VARCHAR(30)     NOT NULL,
    DATE_REG    DATE            DEFAULT NOW(),
    DATE_UPD    DATE,
    DATE_DEL    DATE,
    IS_DELETE   NUMERIC         NOT NULL,
    TIPO        VARCHAR(10)     NOT NULL,
    FTP         VARCHAR(30)     NOT NULL,
    CONSTRAINT  DEL             CHECK       (IS_DELETE IN ('0','1')),
    CONSTRAINT  FK_FTP          FOREIGN KEY (FTP) REFERENCES FTP_USERS(FTP_USER),
    CONSTRAINT  UX              UNIQUE      (EMAIL,USERNAME),
    CONSTRAINT  TYP             CHECK       (TIPO IN ('ADMIN','STANDARD'))
);


update resolve the problem:
the problem was that i declared two different mode for make unique email and username, for resolve this problem i delete unique near the collums and use only unique constraint "UX" for email and username.
thanks all for the support.
This:

EMAIL       VARCHAR(50)     NOT NULL UNIQUE,
USERNAME    VARCHAR(30)     NOT NULL UNIQUE,


makes both EMAIL and USERNAME individually unique, in addition to your other constraint. If only a combination of EMAIL and USERNAME is to be unique, remove UNIQUE from the column definitions.