Open
Description
Plugin: RainLab.Blog
OctoberCMS Version: 3.7.12
RainLab.Blog Version: 1.7.1
Database: SQL Server (tested with ODBC Driver 17)
❗ Description
When using the Blog Post Import feature, after uploading the import file, the system throws the following SQL error on Microsoft SQL Server:
SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]A column has been specified more than once in the order by list. Columns in the order by list must be unique.
Generated SQL query (excerpt):
... ORDER BY [sort_order] ASC, [system_files].[sort_order] ASC
This indicates that the query includes sort_order
twice in the ORDER BY
clause, which is not allowed on SQL Server.
🧪 Steps to Reproduce
- Navigate to Blog > Import Posts in the backend.
- Upload any valid import file.
- Observe the error triggered by duplicate
ORDER BY
clauses.
📌 Notes
- This issue does not occur on MySQL, which silently ignores duplicate columns in the
ORDER BY
clause. - Only affects Microsoft SQL Server, which enforces strict uniqueness on column names in
ORDER BY
. - The error likely originates from the internal query used by the
attachMany
+deferred_bindings
relationship inPostImport
model.
✅ Suggested Fix
Ensure that ORDER BY
clauses generated for file attachments remove duplicate column names when querying deferred bindings.
Metadata
Metadata
Assignees
Labels
No labels