Skip to content

MSSQL Compatibility Notes

binon edited this page Aug 7, 2025 · 4 revisions

MSSQL Compatibility and Plugin Setup Guide

🔍 Overview

This page documents the steps required to set up and run the tool_muprog and related plugins for Moodle using a Microsoft SQL Server (MSSQL) backend. The original plugins were designed for MySQL and required compatibility fixes for MSSQL.


⚠️ Issue Summary

Some plugins (notably tool_muprog and tool_mulib) use SQL-reserved keywords like public as column names. This causes errors when using MSSQL, as it requires reserved words to be escaped using square brackets ([public]).

Errors Encountered

  • Unknown DDL library error
  • Field must contain full specs. Rename skipped

Root Cause

  • public is a reserved keyword in MSSQL.
  • Moodle DDL does not automatically escape it.
  • This breaks plugin installation or upgrades.

✅ Resolution Strategy

Chosen Fix

  • The public column was renamed to ispublic in the plugin’s install.xml, upgrade.php, and all usages.
  • This avoids database-specific syntax and ensures compatibility across both MSSQL and MySQL.
  • All changes were made in a forked version of the plugin to isolate compatibility changes.

Why Not Use [public]?

  • Moodle’s DDL layer doesn’t always handle escaped identifiers ([public]) cleanly.
  • Escaped column names break cross-DB compatibility and future-proofing.
  • Renaming maintains abstraction and consistency.

⚙️ Files changed

image