Skip to content

Postgres fails to create empty tables #283

Description

@AlexJoz

Cannot init Postgres+psycopg2 database, the codes are basically from docs:

init_engine_and_session_factory(url=db_url)
engine = get_engine()
create_all_tables(engine)

Used latest official docker for Postgres (https://hub.docker.com/_/postgres).

My error:

ProgrammingError: (psycopg2.errors.SyntaxError) type modifier is not allowed for type "text"
LINE 4:  data_json TEXT(4294967295) NOT NULL, 
                   ^

[SQL: 
CREATE TABLE data_v2 (
	id SERIAL NOT NULL, 
	data_json TEXT(4294967295) NOT NULL, 
	description VARCHAR(255), 
	experiment_id INTEGER, 
	time_created BIGINT NOT NULL, 
	trial_index INTEGER, 
	generation_strategy_id INTEGER, 
	PRIMARY KEY (id), 
	FOREIGN KEY(experiment_id) REFERENCES experiment_v2 (id), 
	FOREIGN KEY(generation_strategy_id) REFERENCES generation_strategy (id)
)

]

Looks like Text doesn't accept a length argument with PostgreSQL.

data_json: str = Column(Text(LONGTEXT_BYTES), nullable=False)

However, same works perfect with with SQLite.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwontfixThis will not be worked on

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions