I'm trying to create a table, using this schema:
CREATE TABLE IF NOT EXISTS tags (id SERIAL, name TEXT, content TEXT, owner_id BIGINT, uses INTEGER DEFAULT (0), location_id BIGINT, created_at TIMESTAMP DEFAULT (now() at time zone 'utc'), PRIMARY KEY (id));
But i get this error upon trying to create it:
Could not create tags.
Traceback (most recent call last):
File "/root/AzuriteBot/launcher.py", line 119, in init
created = run(table.create(verbose=not quiet, run_migrations=False))
File "uvloop/loop.pyx", line 1494, in uvloop.loop.Loop.run_until_complete
File "/root/AzuriteBot/cogs/utils/db.py", line 662, in create
await con.execute(sql)
File "/usr/local/lib/python3.9/dist-packages/asyncpg/connection.py", line 297, in execute
return await self._protocol.query(query, timeout)
File "asyncpg/protocol/protocol.pyx", line 336, in query
asyncpg.exceptions.UndefinedObjectError: operator class "gin_trgm_ops" does not exist for access method "gin"
could this be a permissions thing? whats the issue?
okay, i just fixed this by running the sql itself instead of trying to do it through a python script. in my case, with db
being the database pool object:
await db.fetch("CREATE TABLE IF NOT EXISTS tags (id SERIAL, name TEXT, content TEXT, owner_id BIGINT, uses INTEGER DEFAULT (0), location_id BIGINT, created_at TIMESTAMP DEFAULT (now() at time zone 'utc'), PRIMARY KEY (id));")