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

CTAS rejects an equivalent VEC_FROMTEXT() decimal spelling with error 1292

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 11.8, 12.3, 13.1, 12.3.3
    • 11.8, 12.3, 13.1
    • Vector search
    • None
    • Linux x86_64

    Description

      CREATE TABLE ... AS SELECT rejects a valid three-element vector produced by VEC_FROMTEXT('[1.0,2.0,3.0]') with error 1292. The compact spelling [1,2,3] produces identical vector bytes and creates a VECTOR(3) column successfully, while inserting the decimal spelling into an explicit VECTOR(3) column also succeeds.

      This occurs when CREATE TABLE ... AS SELECT infers a VECTOR column from VEC_FROMTEXT() whose JSON uses decimal spellings.

      Reproducer

      The behavior was recorded on MariaDB 12.3.3. Run the following equivalent SQL in order:

      CREATE DATABASE vec_test;
      USE vec_test;
      SELECT HEX(VEC_FROMTEXT('[1,2,3]')) = HEX(VEC_FROMTEXT('[1.0,2.0,3.0]')) AS equivalent;
      CREATE TABLE compact AS SELECT VEC_FROMTEXT('[1,2,3]') AS v;
      SHOW CREATE TABLE compact;
      CREATE TABLE explicit_vec (v VECTOR(3));
      INSERT INTO explicit_vec VALUES (VEC_FROMTEXT('[1.0,2.0,3.0]'));
      SELECT VEC_TOTEXT(v) AS explicit_value FROM explicit_vec;

      The controls return equivalent = 1, show that compact.v is vector(3), and return [1,2,3] from the explicit column.

      Then run:

      USE vec_test;
      CREATE TABLE decimal_vec AS SELECT VEC_FROMTEXT('[1.0,2.0,3.0]') AS v;
      SHOW CREATE TABLE decimal_vec;
      SELECT VEC_TOTEXT(v) FROM decimal_vec;

      Decisive observation

      The CREATE TABLE decimal_vec AS SELECT ... statement fails, so the table is not created. The recorded error was:

      ERROR 1292 (22007): Incorrect vector value: '\x00\x00\x80?\x00\x00\x00@\x00\x00@@'

      Semantic mismatch

      The equality control demonstrates that [1,2,3] and [1.0,2.0,3.0] produce identical vector bytes. CTAS successfully preserves the compact expression as VECTOR(3), and an explicit VECTOR(3) column accepts the decimal expression. The decimal-spelling CTAS should therefore also succeed, create a VECTOR(3) column, and return [1,2,3] rather than rejecting the same vector value.

      Attachments

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              noob liu
              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.