sqlite-zstd icon indicating copy to clipboard operation
sqlite-zstd copied to clipboard

Cannot create compression on 2 tables with the same column name

Open austinlau opened this issue 2 years ago • 1 comments

It cannot create compression on 2 tables with the same column name. Run the code below and it duplicates the index name.

import sqlite3

conn = sqlite3.connect(r":memory:")
conn.enable_load_extension(True)
conn.load_extension(r"sqlite_zstd.dll")
conn.enable_load_extension(False)

conn.execute('''
CREATE TABLE table1 (
	id INTEGER NOT NULL, 
	name VARCHAR, 
	data TEXT_JSON, 
	PRIMARY KEY (id)
);
''')
conn.execute('''
CREATE TABLE table2 (
	id INTEGER NOT NULL, 
	name VARCHAR, 
	data TEXT_JSON, 
	PRIMARY KEY (id)
);
''')

conn.execute('''
    SELECT
        zstd_enable_transparent('{"table": "table1", "column": "data", "compression_level": 19, "dict_chooser": "''a''"}'),
        zstd_enable_transparent('{"table": "table2", "column": "data", "compression_level": 19, "dict_chooser": "''a''"}')
    ''')

with the error: OperationalError: Could not create index on dictid

Caused by: 0: index _data_dict_idx already exists 1: Error code 1: SQL error or missing database

austinlau avatar Sep 27 '23 22:09 austinlau

I hit the same error here

gsa-tspaere avatar Feb 01 '25 11:02 gsa-tspaere