Fix special chars problem for Postgres

This commit is contained in:
yangdx
2025-04-17 22:58:36 +08:00
parent 14b4bc96ce
commit a3ca134e97
3 changed files with 10 additions and 5 deletions

View File

@@ -1049,10 +1049,10 @@ class PGGraphStorage(BaseGraphStorage):
Returns:
Normalized node ID suitable for Cypher queries
"""
# Remove quotes
normalized_id = node_id.strip('"')
# Escape backslashes
normalized_id = node_id
normalized_id = normalized_id.replace("\\", "\\\\")
normalized_id = normalized_id.replace('"', '\\"')
return normalized_id
async def initialize(self):