Merge pull request #1512 from danielaskdd/fix-json-postgres

Fix node names with JSON formatting were mistakenly interpreted as JSON objects for PostgreSQL AGE graph storage
This commit is contained in:
Daniel.y 2025-05-04 02:29:58 +08:00 committed by GitHub
commit ec8e6a1571
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1252,15 +1252,7 @@ class PGGraphStorage(BaseGraphStorage):
elif dtype == "edge":
d[k] = json.loads(v)
else:
try:
d[k] = (
json.loads(v)
if isinstance(v, str)
and (v.startswith("{") or v.startswith("["))
else v
)
except json.JSONDecodeError:
d[k] = v
d[k] = v # Keep as string
return d