sysbench-tpcc icon indicating copy to clipboard operation
sysbench-tpcc copied to clipboard

Fix force_pk in PostgreSQL

Open nuno-faria opened this issue 3 years ago • 0 comments

The current implementation of the auto incremented primary key in the History table uses id int NOT NULL AUTO_INCREMENT for all database engines. However, the correct code for PostgreSQL should be id serial NOT NULL, as can be confirmed in the docs.

Currently, the prepare results in the following error:

FATAL: PQexec() failed: 7 syntax error at or near "AUTO_INCREMENT"
FATAL: failed query was:        create table IF NOT EXISTS history1 (
        id int NOT NULL AUTO_INCREMENT,
        h_c_id int,
        h_c_d_id smallint,
        h_c_w_id smallint,
        h_d_id smallint,
        h_w_id smallint,
        h_date timestamp,
        h_amount decimal(6,2),
        h_data varchar(24) ,PRIMARY KEY(id)
        )
FATAL: `sysbench.cmdline.call_command' function failed: ./tpcc_common.lua:242: SQL error, errno = 0, state = '42601': syntax error at or near "AUTO_INCREMENT"

This commit fixes this error.

nuno-faria avatar Aug 24 '21 16:08 nuno-faria