Is there any benefit to using a table schema like this:
CREATE TABLE review (
review_id SERIAL PRIMARY KEY,
account_id INT REFERENCES account(account_id) NOT NULL,
product_id INT REFERENCES product(product_id) NOT NULL,
rating SMALLINT NOT NULL,
comment TEXT,
UNIQUE (account_id, product_id)
);
Or should the constraint itself be the primary key, like this:
CREATE TABLE review (
CONSTRAINT review_pkey (account_id, product_id) PRIMARY KEY,
account_id INT REFERENCES account(account_id) NOT NULL,
product_id INT REFERENCES product(product_id) NOT NULL,
rating SMALLINT NOT NULL,
comment TEXT,
);