class

Memo::Dialect::Postgres

Inherits Memo::Dialect::Base < Reference < Object

Constants

MIGRATION_LOCK = 1835363695_i64

Any constant shared by every memo process ("memo" in ASCII)

SCHEMA_SQL = {{ read_file("/tmp/tmp.AcleAa/src/src/memo/dialect/../../../db/schema/memo_schema_pg.sql") }}

Instance methods

db_file_path(db : DB::Database) : String | Nil

Get the database file path from a connection, if applicable.

SQLite: reads pragma_database_list PostgreSQL: returns nil (no local file)

Source
drop_legacy_texts(db : DBHandle) : Nil

Drop the tables content-addressed storage replaced (memo_texts and its full-text index).

Source
embedding_rowid_column

The column name for embedding row identity used as USearch key.

SQLite: "rowid" (implicit) PostgreSQL: "eid" (explicit column)

Source
fts_join_sql

Build FTS JOIN clause for search queries (joining a chunk's text).

Source
fts_where_sql

Build FTS WHERE clause for match queries.

Source
insert_or_ignore_sql(table : String, columns : String, placeholders : String) : String

Build INSERT OR IGNORE SQL.

Source
insert_returning_id(db : DBHandle, sql : String, *args) : Int64

Execute an INSERT and return the generated ID.

Source
lock_for_migration(db : DB::Connection) : Nil

Two processes opening the database at once would otherwise both migrate it. The lock is released when the transaction ends.

Source
schema_statements

Get schema DDL statements.

Source
table_exists?(db : DBHandle, table : String) : Bool
Source
upsert_sql(table : String, columns : String, placeholders : String, conflict_columns : String, update_columns : Array(String)) : String

Build upsert SQL (INSERT OR REPLACE equivalent).

Source