Skip to content

fix(postgres): Add CASCADE to AGE extension creation for automatic dependency resolution#2446

Merged
danielaskdd merged 1 commit intoHKUDS:mainfrom
danielaskdd:fix-postgres
Dec 1, 2025
Merged

fix(postgres): Add CASCADE to AGE extension creation for automatic dependency resolution#2446
danielaskdd merged 1 commit intoHKUDS:mainfrom
danielaskdd:fix-postgres

Conversation

@danielaskdd
Copy link
Collaborator

fix(postgres): Add CASCADE to AGE extension creation for automatic dependency resolution

Description

Problem

When initializing PostgreSQL graph storage, the AGE (Apache Graph Extension) creation could fail if any dependent extensions were not pre-installed on the PostgreSQL server. This resulted in the error:

asyncpg.exceptions.UndefinedFunctionError: function create_graph(unknown) does not exist

Solution

Added CASCADE keyword to the CREATE EXTENSION statement for Apache AGE. This ensures that any required dependent extensions are automatically installed when AGE is created.

Changes

  • Modified configure_age_extension() in lightrag/kg/postgres_impl.py
  • Changed from: CREATE EXTENSION IF NOT EXISTS age
  • Changed to: CREATE EXTENSION IF NOT EXISTS AGE CASCADE

Impact

  • Improves compatibility across different PostgreSQL deployments
  • Reduces manual configuration requirements for users
  • No breaking changes to existing functionality

Testing

  • Verified that AGE extension is created successfully with CASCADE option
  • Confirmed backward compatibility with existing PostgreSQL deployments

- Add CASCADE option to CREATE EXTENSION
- Ensure dependencies are installed
- Fix potential AGE setup issues
@danielaskdd
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielaskdd danielaskdd merged commit 48b6a6d into HKUDS:main Dec 1, 2025
4 checks passed
@danielaskdd danielaskdd deleted the fix-postgres branch December 1, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant