[MDEV-28678] UDF + ORDER BY returns twice the value in view Created: 2022-05-27  Updated: 2022-12-02  Resolved: 2022-12-02

Status: Closed
Project: MariaDB Server
Component/s: Views
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.10.3

Type: Bug Priority: Minor
Reporter: Lena Startseva Assignee: Oleksandr Byelkin
Resolution: Not a Bug Votes: 0
Labels: view-protocol

Issue Links:
PartOf
is part of MDEV-27691 make working view-protocol Open

 Description   

Test:

--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval CREATE FUNCTION udf_sequence RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (4),(3),(2),(1);
 
SELECT udf_sequence() AS seq FROM t1 ORDER BY seq ;
CREATE VIEW v1 as SELECT udf_sequence() AS seq FROM t1 ORDER BY seq ;
SELECT * FROM v1;
DROP VIEW v1;
 
DROP FUNCTION udf_sequence;
DROP TABLE t1;

Actual value:

seq
2
4
6
8

Expected value:

seq
1
2
3
4



 Comments   
Comment by Oleksandr Byelkin [ 2022-12-01 ]

It is an example of non-deterministic function so behaviour is not deterministic (and there is no way to inform server about it).

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