server
server copied to clipboard
MDEV-27013: COM_STMT_PREPARE returns 0 columns for INSERT .. RETURNING
- [x] The Jira issue number for this PR is: MDEV-27013
Description
If this was a SELECT statement, the columns would be populated by the mysql_test_insert call to send_prep_stmt. So we need to get the column count for returning statements and populate this instead of 0.
Release Notes
TODO: What should the release notes say about this change? Include any changed system variables, status variables or behaviour. Optionally list any https://mariadb.com/kb/ pages that need changing.
How can this PR be tested?
$ socat -x -v UNIX-LISTEN:/tmp/intercept.sock,fork UNIX-CONNECT:/tmp/build-mariadb-server-rebase.sock
$ tests/mariadb-client-test -S /tmp/intercept.sock -u dan -D test test_mdev_27013
#####################################
client_connect
#####################################
Establishing a connection to '' ...OK
Connected to MySQL server version: 10.6.22-MariaDB (100622)
Creating a test database 'client_test_db' ...OK
#####################################
1 of (1/1): test_mdev27013
#####################################
err: Unknown or undefined error code/home/dan/repos/mariadb-server-rebase/tests/mysql_client_test.c:21902: check failed: 'rc == 0'
> 2025/05/15 17:15:46.000580099 length=82 from=485 to=566
05 00 00 00 19 01 00 00 00 37 00 00 00 16 49 4e .........7....IN
53 45 52 54 20 49 4e 54 4f 20 6d 64 65 76 32 37 SERT INTO mdev27
30 31 33 20 28 63 31 29 20 56 41 4c 55 45 53 28 013 (c1) VALUES(
27 74 77 65 65 74 27 29 20 52 45 54 55 52 4e 49 'tweet') RETURNI
4e 47 20 2a 0a NG *.
00 00 00 17 ff ff ff ff 00 01 00 00 00 .............
--
< 2025/05/15 17:15:46.000580299 length=16 from=430 to=445
0c 00 00 01 00 02 00 00 00 02 00 00 00 00 00 00 ................
--
< 2025/05/15 17:15:46.000580330 length=162 from=446 to=607
02 00 00 01 02 01 3b 00 00 02 03 64 65 66 0e 63 ......;....def.c
6c 69 65 6e 74 5f 74 65 73 74 5f 64 62 09 6d 64 lient_test_db.md
65 76 32 37 30 31 33 09 6d 64 65 76 32 37 30 31 ev27013.mdev2701
33 02 63 31 02 63 31 00 0c 2d 00 90 00 00 00 fe 3.c1.c1..-......
00 00 00 00 00 3b 00 00 03 03 64 65 66 0e 63 6c .....;....def.cl
69 65 6e 74 5f 74 65 73 74 5f 64 62 09 6d 64 65 ient_test_db.mde
76 32 37 30 31 33 09 6d 64 65 76 32 37 30 31 33 v27013.mdev27013
02 63 32 02 63 32 00 0c 2d 00 90 00 00 00 fe 00 .c2.c2..-.......
00 00 00 00 05 00 00 04 fe 00 00 02 00 08 00 00 ................
05 00 08 05 74 77 65 65 74 05 00 00 06 fe 00 00 ....tweet.......
02 00 ..
--
Basing the PR against the correct MariaDB version
- [ ] This is a new feature or a refactoring, and the PR is based against the
mainbranch. - [X] This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.
PR quality check
- [X] I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
- [X] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.