Create a table with a check constraint:
create table t (i int, constraint a check (i > 0));
|
Now consider this query, which should produce the above check constraint:
select
|
tc.TABLE_SCHEMA,
|
tc.TABLE_NAME,
|
cc.CONSTRAINT_NAME,
|
cc.CHECK_CLAUSE
|
from information_schema.TABLE_CONSTRAINTS tc
|
join information_schema.CHECK_CONSTRAINTS cc
|
using (CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, TABLE_NAME, CONSTRAINT_NAME)
|
;
|
It does not produce any results.
Add two columns to the projection and ta-dah, we get the desired output:
select
|
tc.TABLE_SCHEMA,
|
tc.TABLE_NAME,
|
cc.CONSTRAINT_NAME,
|
cc.CHECK_CLAUSE,
|
tc.CONSTRAINT_CATALOG,
|
tc.CONSTRAINT_SCHEMA
|
from information_schema.TABLE_CONSTRAINTS tc
|
join information_schema.CHECK_CONSTRAINTS cc
|
using (CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, TABLE_NAME, CONSTRAINT_NAME)
|
;
|
{"report":{"fcp":1138.2999999523163,"ttfb":339.2999999523163,"pageVisibility":"visible","entityId":80842,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"2568fc20-9228-48e8-8e73-d14e043feb16","navigationType":0,"readyForUser":1217.3999998569489,"redirectCount":0,"resourceLoadedEnd":1497.1999998092651,"resourceLoadedStart":345.59999990463257,"resourceTiming":[{"duration":242.20000004768372,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":345.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":345.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":587.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":242.39999985694885,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":345.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":345.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":588.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":256,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":346,"connectEnd":346,"connectStart":346,"domainLookupEnd":346,"domainLookupStart":346,"fetchStart":346,"redirectEnd":0,"redirectStart":0,"requestStart":346,"responseEnd":602,"responseStart":602,"secureConnectionStart":346},{"duration":420,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":346.19999980926514,"connectEnd":346.19999980926514,"connectStart":346.19999980926514,"domainLookupEnd":346.19999980926514,"domainLookupStart":346.19999980926514,"fetchStart":346.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":346.19999980926514,"responseEnd":766.1999998092651,"responseStart":766.1999998092651,"secureConnectionStart":346.19999980926514},{"duration":431.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":346.39999985694885,"connectEnd":346.39999985694885,"connectStart":346.39999985694885,"domainLookupEnd":346.39999985694885,"domainLookupStart":346.39999985694885,"fetchStart":346.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":346.39999985694885,"responseEnd":778,"responseStart":778,"secureConnectionStart":346.39999985694885},{"duration":431.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":346.69999980926514,"connectEnd":346.69999980926514,"connectStart":346.69999980926514,"domainLookupEnd":346.69999980926514,"domainLookupStart":346.69999980926514,"fetchStart":346.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":346.69999980926514,"responseEnd":778.3999998569489,"responseStart":778.3999998569489,"secureConnectionStart":346.69999980926514},{"duration":431.89999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":346.7999999523163,"connectEnd":346.7999999523163,"connectStart":346.7999999523163,"domainLookupEnd":346.7999999523163,"domainLookupStart":346.7999999523163,"fetchStart":346.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":346.7999999523163,"responseEnd":778.6999998092651,"responseStart":778.6999998092651,"secureConnectionStart":346.7999999523163},{"duration":441.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":347,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":347,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":788.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":432,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":347.09999990463257,"connectEnd":347.09999990463257,"connectStart":347.09999990463257,"domainLookupEnd":347.09999990463257,"domainLookupStart":347.09999990463257,"fetchStart":347.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":347.09999990463257,"responseEnd":779.0999999046326,"responseStart":779.0999999046326,"secureConnectionStart":347.09999990463257},{"duration":441.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":347.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":347.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":788.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":432.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":347.5,"connectEnd":347.5,"connectStart":347.5,"domainLookupEnd":347.5,"domainLookupStart":347.5,"fetchStart":347.5,"redirectEnd":0,"redirectStart":0,"requestStart":347.5,"responseEnd":779.6999998092651,"responseStart":779.6999998092651,"secureConnectionStart":347.5},{"duration":1144.1000001430511,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":348.39999985694885,"connectEnd":348.39999985694885,"connectStart":348.39999985694885,"domainLookupEnd":348.39999985694885,"domainLookupStart":348.39999985694885,"fetchStart":348.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":348.39999985694885,"responseEnd":1492.5,"responseStart":1492.5,"secureConnectionStart":348.39999985694885},{"duration":1144.5999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":352.59999990463257,"connectEnd":352.59999990463257,"connectStart":352.59999990463257,"domainLookupEnd":352.59999990463257,"domainLookupStart":352.59999990463257,"fetchStart":352.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":352.59999990463257,"responseEnd":1497.1999998092651,"responseStart":1497.1999998092651,"secureConnectionStart":352.59999990463257},{"duration":725.5999999046326,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":766.2999999523163,"connectEnd":766.2999999523163,"connectStart":766.2999999523163,"domainLookupEnd":766.2999999523163,"domainLookupStart":766.2999999523163,"fetchStart":766.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":766.2999999523163,"responseEnd":1491.8999998569489,"responseStart":1491.8999998569489,"secureConnectionStart":766.2999999523163},{"duration":382.5,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1127.3999998569489,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1127.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1509.8999998569489,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":141,"responseStart":339,"responseEnd":343,"domLoading":343,"domInteractive":1670,"domContentLoadedEventStart":1670,"domContentLoadedEventEnd":1757,"domComplete":2310,"loadEventStart":2310,"loadEventEnd":2311,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1643.7999999523163},{"name":"bigPipe.sidebar-id.end","time":1644.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1644.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.end","time":1646.2999999523163},{"name":"activityTabFullyLoaded","time":1780}],"measures":[],"correlationId":"bcd00bb00ddf37","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":109,"dbReadsTimeInMs":17,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Check natural join, probably we have probem with it