Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: case-sensitive column reference in knowledge table CHECK constraint #2058

Merged
merged 4 commits into from
Jan 9, 2025

Conversation

antman1p
Copy link

@antman1p antman1p commented Jan 9, 2025

Resolves a SQL error (42703: column "isshared" does not exist) in the knowledge table's CHECK constraint. The issue was caused by an incorrect column reference due to PostgreSQL’s case sensitivity when handling column names inside constraints.

Relates to

N/A (No associated issue, direct fix for database schema error)

Risks

Low

Background

What does this PR do?

  • Fixes a SQL syntax error in the knowledge table’s CHECK constraint by ensuring the "isShared" column is referenced with proper case sensitivity.

What kind of change is this?

Bug fix (non-breaking change which fixes an issue)

Why are we doing this? Any context or related work?

The error "column 'isshared' does not exist" (42703) occurs because the column name isShared in the CHECK constraint is written incorrectly. PostgreSQL is case-sensitive when referencing column names inside constraints, so "isShared" should be used instead of isShared.

Documentation changes needed?

✅ My changes do not require a change to the project documentation.

Testing

Where should a reviewer start?

Copy and paste the original sql into supabase's sql editor and you will see the error:

ERROR:  42703: column "isshared" does not exist
LINE 173:     CHECK((isShared = true AND "agentId" IS NULL) OR (isShared = false AND "agentId" IS NOT NULL))
                     ^
HINT:  Perhaps you meant to reference the column "knowledge.isShared"

Detailed testing steps

Copy and paste this sql change into the supabase.postgres sql editor and press run. Verufy that the tables built sucessfully.

Deploy Notes

Database changes

Fixes the knowledge table's CHECK constraint to properly reference "isShared".

Discord username

4n7m4n

Resolves a SQL error (42703: column "isshared" does not exist) in the knowledge table's CHECK constraint. The issue was caused by an incorrect column reference due to PostgreSQL’s case sensitivity when handling column names inside constraints.
@antman1p antman1p changed the title Fix case-sensitive column reference in knowledge table CHECK constraint Fix: case-sensitive column reference in knowledge table CHECK constraint Jan 9, 2025
Copy link
Collaborator

@monilpat monilpat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@monilpat monilpat merged commit 79f5903 into elizaOS:develop Jan 9, 2025
3 checks passed
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.

2 participants