Skip to content

Escape "vector" reserved keyword for MariaDB 11.6+ support - #12

Open
scotteuser wants to merge 1 commit into
allanpichardo:mainfrom
scotteuser:mariadb-11-8-support
Open

Escape "vector" reserved keyword for MariaDB 11.6+ support#12
scotteuser wants to merge 1 commit into
allanpichardo:mainfrom
scotteuser:mariadb-11-8-support

Conversation

@scotteuser

Copy link
Copy Markdown
Contributor

"vector" became a reserved keyword in MariaDB 11.6+ resulting in errors like this:

mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '
                normalized_vector JSON,
                magnitude DOUBLE,
  ...' at line 3

See https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/reserved-words

This PR just surrounds all usage of vector with backticks.

@scotteuser

Copy link
Copy Markdown
Contributor Author

Created related issue here: #13

Comment thread src/VectorTable.php
"CREATE TABLE %s %s (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
vector JSON,
`vector` JSON,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using embedding_vector instead could be an alternative fix that eliminates reserved word usage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That'd need a migration path though to convert existing databases, it's far simpler to just wrap in backticks like this imo

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed about the impact, was not sure about the BC policy here, just wanted to raise the alternative that removed reserved word usage.

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