question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not parse CHECK constraint text

See original GitHub issue

Hello,

I have the following CHECK constraint on one of my tables:

CONSTRAINT ownership_fk CHECK(foreign_property('OWNERSHIP', ownership_id))

And I am getting the following warning using sqlalchemy 1.3.8:

c:\program files\python37\lib\site-packages\sqlalchemy\dialects\postgresql\base.py:3450: 
SAWarning: Could not parse CHECK constraint text: "CHECK (foreign_property('OWNERSHIP'::text, (ownership_id)::text))"

What should I do to fix or suppress this warning?

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gordthompsoncommented, Dec 18, 2019

@pipriles - Your fix seems to work fine. Thanks!

1reaction
gordthompsoncommented, Dec 18, 2019

@pipriles - I did some testing and if foreign_property is a user-defined function that returns a boolean value you could also avoid the warning by changing your CHECK constraint from

CONSTRAINT ... CHECK(foreign_property('OWNERSHIP', ownership_id))

to

CONSTRAINT ... CHECK(foreign_property('OWNERSHIP', ownership_id) = true)

I’ve also started working on a patch for this issue. Stay tuned …

Read more comments on GitHub >

github_iconTop Results From Across the Web

O2SS0007: Check constraint condition not parsed (Error)
When you try to convert the schema of a table having a constraint condition which is checking for NAN values, SSMA generates an...
Read more >
Parsing SQL Check Constraint - Stack Overflow
Simple answer: this will NOT be easy. At least not if you're trying to do it right... You are talking about defining a...
Read more >
Parsing check constraints - Oracle Communities
Hello, I need to write a tool that will analyze the text of the check constraints ; but before starting, I wanted to...
Read more >
How to use SQL Check Constraints - SQLShack
This article will show details about SQL check constraints and the relationship between constraints and query performance.
Read more >
How to Use Check Constraint in PostgreSQL?
Values that meet the specified criteria/condition will be inserted/updated into PostgreSQL, while those that do not will be rejected. This post ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found