[MDEV-31435] Stored Procedure not sorting correctly Created: 2023-06-08  Updated: 2023-10-16  Resolved: 2023-10-16

Status: Closed
Project: MariaDB Server
Component/s: Stored routines
Affects Version/s: 11.1.1
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Sean Connolly Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: None
Environment:

Windows 10 Professional 64-bit


Attachments: File A-Z Direct Point-to-Point.sql     JPEG File AZ Direct Point-to-Point Procedure(Bad).jpg     JPEG File NonProcedure Select (Good).jpg     File NonProcedureTest.sql    

 Description   

Just recently, I was advised to upgrade from MySQL to MariaDB for a much faster experience and ended up downloading Version 11.1.1.

I am writing some stored procedures that I can pass in parameters and perform a customised query. I have discovered a bug when it comes to the ORDER BY in the stored procedure which is not working correctly, but when I created the same sql select outside of a stored procedure, the ORDER BY is working correctly.

Attached is the stored procedure and the manual select alongside two jpegs to show the difference (from row 5 onwards) where the order should be in the order of the "Dayset", followed by "Depart", "Arrive" and "StartDate", but the StartDate is not sorting correctly.



 Comments   
Comment by Sergei Golubchik [ 2023-06-29 ]

can you show the table structure for AZResults ?

Comment by Sean Connolly [ 2023-07-14 ]

The table AZResults is a temporary table which is created directly inside the SQL code as shown in the attached files. The ORDER BY works when I create a direct query instead of using a stored procedure. It only breaks when it is inside the stored procedure.

Comment by Alice Sherepa [ 2023-09-15 ]

CosineCuber Could you please provide the test case to demonstrate the bug?
Or please add SHOW CREATE TABLE for MainUIDList,LocationInfo,StationDetails and your .cnf file(s)

Generated at Thu Feb 08 10:23:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.