unique constraint on Bytea data type on Postgresql
Create a unique index on a digest:
CREATE UNIQUE INDEX idx_image_hash ON images (digest(img, 'sha1'));
This assumes you have the pgcrypto extension installed:
CREATE EXTENSION pgcrypto;
Create a unique index on a digest:
CREATE UNIQUE INDEX idx_image_hash ON images (digest(img, 'sha1'));
This assumes you have the pgcrypto extension installed:
CREATE EXTENSION pgcrypto;