Skip to content

Commit 51b0b6e

Browse files
committed
Fixed tests.
1 parent 5310f12 commit 51b0b6e

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

cpp/deeplake_pg/pg_deeplake.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,10 @@ void save_index_metadata(Oid oid)
265265
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("Failed to save metadata")));
266266
}
267267

268-
// Persist index to shared catalog for stateless multi-instance sync
269-
if (pg::stateless_enabled) {
268+
// Persist index to shared catalog for stateless multi-instance sync.
269+
// Skip when in catalog-only mode — the table was synced FROM the catalog,
270+
// so writing back would be redundant and cause version bump loops.
271+
if (pg::stateless_enabled && !pg::table_storage::is_catalog_only_create()) {
270272
try {
271273
auto root_dir = pg::session_credentials::get_root_path();
272274
if (root_dir.empty()) {

postgres/tests/py_tests/test_drop_table_column.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async def test_drop_table_column(db_conn: asyncpg.Connection):
2525
try:
2626
# Create table with multiple columns
2727
await db_conn.execute("""
28-
CREATE TABLE vectors (
28+
CREATE TABLE drop_col_vectors (
2929
id SERIAL PRIMARY KEY,
3030
v1 float4[],
3131
v2 float4[]
@@ -34,7 +34,7 @@ async def test_drop_table_column(db_conn: asyncpg.Connection):
3434

3535
# Create index on v2 (not v1)
3636
await db_conn.execute("""
37-
CREATE INDEX index_for_v2 ON vectors USING deeplake_index (v2 DESC)
37+
CREATE INDEX index_for_v2 ON drop_col_vectors USING deeplake_index (v2 DESC)
3838
""")
3939

4040
# Verify index exists in pg_class
@@ -60,7 +60,7 @@ async def test_drop_table_column(db_conn: asyncpg.Connection):
6060
f"Dataset directory '{dataset_path}' should exist before DROP COLUMN"
6161

6262
# DROP non-indexed column (v1) - index should remain
63-
await db_conn.execute("ALTER TABLE vectors DROP COLUMN v1")
63+
await db_conn.execute("ALTER TABLE drop_col_vectors DROP COLUMN v1")
6464

6565
# Verify index still exists after dropping non-indexed column
6666
await assertions.assert_query_row_count(
@@ -83,7 +83,7 @@ async def test_drop_table_column(db_conn: asyncpg.Connection):
8383
f"Dataset directory '{dataset_path_after_v1}' should exist after dropping non-indexed column"
8484

8585
# DROP indexed column (v2) - index should be removed
86-
await db_conn.execute("ALTER TABLE vectors DROP COLUMN v2")
86+
await db_conn.execute("ALTER TABLE drop_col_vectors DROP COLUMN v2")
8787

8888
# Verify index removed from pg_class
8989
await assertions.assert_query_row_count(
@@ -108,4 +108,4 @@ async def test_drop_table_column(db_conn: asyncpg.Connection):
108108
finally:
109109
# Cleanup (in case test fails)
110110
await db_conn.execute("DROP INDEX IF EXISTS index_for_v2 CASCADE")
111-
await db_conn.execute("DROP TABLE IF EXISTS vectors CASCADE")
111+
await db_conn.execute("DROP TABLE IF EXISTS drop_col_vectors CASCADE")

0 commit comments

Comments
 (0)