Repository navigation
fix: run DEEIX on Nile Postgres without changing other databases - #780
Open
buddhism5080 wants to merge 18 commits into
Open
buddhism5080 wants to merge 18 commits into
buddhism5080 wants to merge 18 commits into
Conversation
buddhism5080
force-pushed
the
feat/nile-postgres
branch
4 times, most recently
from
September 30, 2026 04:03
fa387b3 to
5c4cb0e
Compare
buddhism5080
force-pushed
the
feat/nile-postgres
branch
2 times, most recently
from
October 10, 2026 02:20
1b01275 to
0c05e93
Compare
buddhism5080
force-pushed
the
feat/nile-postgres
branch
2 times, most recently
from
October 13, 2026 16:25
ec2406d to
a8f9c2b
Compare
buddhism5080
force-pushed
the
feat/nile-postgres
branch
from
October 21, 2026 14:56
a8f9c2b to
8220fd1
Compare
|
This pull request has had no activity for 7 days. It will be closed in 7 days if there is no further activity. |
Gateways that reject the COMMENT command tag fail startup because GORM and the baseline migration treat COMMENT ON as fatal. SCHEMA_COMMENTS=false skips those statements and clears parsed field comments before migrate.
Nile reports client_encoding as UTF-8, so pgx refuses the simple-protocol probe GORM uses during AutoMigrate. current_database() also differs from information_schema.table_catalog, which made AutoMigrate add existing columns.
Only use current_catalog when it differs from current_database() and information_schema is actually catalogued under that other name. UTF-8 client_encoding is rewritten only when the server does not report UTF8.
Ordinary Postgres still creates the partial unique index. A gateway that rejects AND in an index WHERE clause gets the equivalent expression index, which is NULL unless the file is active, not deleted, and has a sha256.
The usage-reference index also puts AND in its WHERE clause. Ordinary Postgres still creates that partial index. The same gateway error now creates the equivalent expression index instead of stopping startup.
Hosts under thenile.dev skip COMMENT, normalize UTF-8, and replace the two slow GORM constraint joins plus the AND partial unique indexes before they run. Other Postgres hosts keep the original statements.
Nile hosts skip COMMENT ON based on the database address. There is no environment variable or config flag for it.
Nile's extended protocol turns a bound empty string into NULL, so the vendor seed insert fails the icon NOT NULL check and the process restarts.
The gateway rejects the CREATE EXTENSION command tag even when vector is already installed. On a Nile host, read pg_extension and continue the vector baseline.
GORM's format_type and information_schema.columns queries were the statements still taking more than a second per table. Read the same values from pg_attribute by regclass.
Per-table catalog lookups are independent once foreign keys are disabled and missing tables already exist. Nile runs eight of them at once. Other databases stay serial.
The gateway rejects CREATE INDEX CONCURRENTLY and DROP INDEX CONCURRENTLY. The HNSW definition stays the same; only the command form changes on a Nile host.
The gateway rejects functions inside an index expression, so the HNSW index cannot use vector_dims or subvector. Nile stores the same 4000-dimension candidate in embedding_hnsw and indexes that column. The original vector remains for exact reranking. Other databases keep the expression index.
The pg_class join used to read file_chunks.embedding took about 1.4s. On Nile, resolve the table with to_regclass instead. Ordinary Postgres keeps the original join.
The workspace quality check rejects interface{} in production Go.
Saving embedding settings waited on a catalog scan that does not return on Nile. Look the HNSW index up by name instead.
The pg_class join still took 1.6s per existing index. Matching pg_index.indexrelid to to_regclass returns in about 0.23s.
Upstream renamed this directory from package db to package postgres. The Nile files still declared package db, so they were a second package in the same directory and were not the package the repositories import.
buddhism5080
force-pushed
the
feat/nile-postgres
branch
from
October 29, 2026 18:58
8220fd1 to
9348a13
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hosts under
*.thenile.devtake Nile-safe SQL directly. Ordinary Postgres, including a database namednileon another host, is unchanged.COMMENT ON. Nile returnscommand tag COMMENT unhandled.UTF-8toUTF8and send parameters with the simple protocol, so an empty string is not delivered as NULL.information_schemaconstraint join withpg_constraint. Column metadata andformat_typelookups readpg_attributebyregclass.WHEREclause containsANDinto expression indexes with the same uniqueness rule.vectorextension instead ofCREATE EXTENSION.embedding_hnswand index that column. Nile rejects functions inside an index expression and rejectsCREATE INDEX CONCURRENTLY. The originalembeddingcolumn is still used for exact reranking.摘要
只在数据库地址是
*.thenile.dev时改写 SQL。普通 Postgres 保持原语句。Nile 会拒绝
COMMENT ON、CREATE EXTENSION、CREATE INDEX CONCURRENTLY,以及索引表达式里的函数。带AND的部分唯一索引会改成语义相同的表达式索引。向量仍按模型原始维度存在embedding,候选用单独的halfvec(4000)列建 HNSW。Test plan
go test ./internal/infra/persistence/postgres/ ./internal/infra/persistence/schema/ ./internal/infra/persistence/vectorutil/ ./internal/infra/persistence/postgres/conversation/ ./internal/infra/persistence/postgres/memory/SQLSTATEduring migration