Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-32876

Allow stored functions in CHECK constraints

    XMLWordPrintable

Details

    Description

      We should be able to use stored functions in CHECK constraints:

      CREATE OR REPLACE TABLE t (
          email VARCHAR(100) NOT NULL CHECK (is_email(email))
      );
      

      PostgreSQL and SQL Server allow this. I didn't check other DBMSs.

      PostgreSQL assumes that the function logic never changes. If you replace the function with a new version, it won't notice if CHECK constraints fail. I think that this is a reasonable limitation.

      Since MariaDB has a [NOT] DETERMINISTIC clause, it would also be reasonable to only allow DETERMINISTIC functions in CHECK constraints.

      Attachments

        Activity

          People

            Unassigned Unassigned
            f_razzoli Federico Razzoli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.