agentscope-ai / agentscope-ai/agentscope-java

PostgresBaseStore UPSERT_SQL has an extra comma and fails updates

Đang mở
#2,143 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
area/harness bug
Ngôn ngữ chính
Java
Star
5.6k
Fork
1.3k
Merge trung bình
4 ngày 12 giờ
Pull request đã merge (30 ngày)
77

Mô tả

## Bug

`PostgresBaseStore.UPSERT_SQL` contains an extra comma after the version assignment:

```sql
ON CONFLICT (namespace_path, item_key) DO UPDATE SET
value_json = EXCLUDED.value_json,
version = %1$s.version + 1,,
updated_at = EXCLUDED.updated_at
```

The `,,` makes every update of an existing key through `BaseStore.put(...)` invalid PostgreSQL syntax. This blocks the official `PostgresDistributedStore` remote-filesystem/state composition and cross-replica production acceptance.

Observed against `e3a412ed2cc944e401da861c8d5e464b967724e9` in:

`agentscope-extensions-postgresql/.../store/PostgresBaseStore.java`

## Expected fix

Remove the extra comma and add a real PostgreSQL integration test that proves:

1. first `put` inserts version 1;
2. second `put` updates value and version to 2;
3. two independent clients using the same stale version with `putIfVersion` accept exactly one writer;
4. namespace isolation/search/delete remain correct;
5. `PostgresDistributedStore` fresh-client state, BaseStore, snapshot and execution-guard composition works.

A source-only SQL assertion is not sufficient; the regression should execute against PostgreSQL because formatting/table-name substitution and transaction behavior are part of the contract.

## Impact

Applications selecting the newly released PostgreSQL distributed Harness state can initialize schemas and perform an initial insert, but normal overwrite/update through `BaseStore.put` fails at runtime. Product hosts should not patch or replace the official BaseStore, so production readiness must remain false until the extension is fixed.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.