Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function sys.isauuid(string) should return false if string value cannot be converted to a UUID #6784

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2019-11-06 16:48:41 +0100
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: 11.33.3 (Apr2019)
CC: @kutsurak

Last updated: 2019-11-28 10:00:05 +0100

Comment 27397

Date: 2019-11-06 16:48:41 +0100
From: Martin van Dinther <<martin.van.dinther>>

User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0
Build Identifier:

function
sys.isauuid(str) return boolean
can be used to test whether the string argument represents a valid UUID string.
However it reports a GDK error if the str argument is not a valid UUID string!
Expected to return false instead of an error as it is a test function, similar to sys.isaurl(str).

Reproducible: Always

Steps to Reproduce:

-- examples which return errors, but should have returned false
select isauuid('this is not a uuid');
-- returns: GDK reported error: Syntax error in UUID. expected false
select isauuid('');
-- returns: GDK reported error: Syntax error in UUID. expected false
select isauuid(4);
-- returns: GDK reported error: Syntax error in UUID. expected false
select isauuid('XYZaee1a538-aca1-381b-d9f4-8c29ef3f5');
-- returns: GDK reported error: Syntax error in UUID. expected false

-- some tests which return correct output
select isauuid(uuid());
-- returns true
select isauuid('aee1a538-aca1-381b-d9f4-8c29ef3f5f34');
-- returns true
select isauuid('AEE1A538-ACA1-381B-D9F4-8C29EF3F5F34');
-- returns true
select isauuid(null);
-- returns false
select cast('aee1a538-aca1-381b-d9f4-8c29ef3f5f34' as uuid);
select cast('AEE1A538-ACA1-381B-D9F4-8C29EF3F5F34' as uuid);

-- test which correctly returns an error
select cast('XYZaee1a538-aca1-381b-d9f4-8c29ef3f5' as uuid);
-- returns: Not a UUID

Actual Results:

sql>-- examples which return errors, but should have returned false
sql>select isauuid('this is not a uuid');
GDK reported error: Syntax error in UUID.
sql>-- returns: GDK reported error: Syntax error in UUID. expected false
sql>select isauuid('');
GDK reported error: Syntax error in UUID.
sql>-- returns: GDK reported error: Syntax error in UUID. expected false
sql>select isauuid(4);
GDK reported error: Syntax error in UUID.
sql>-- returns: GDK reported error: Syntax error in UUID. expected false
sql>select isauuid('XYZaee1a538-aca1-381b-d9f4-8c29ef3f5');
GDK reported error: Syntax error in UUID.
sql>-- returns: GDK reported error: Syntax error in UUID. expected false
sql>
sql>-- some tests which return correct output
sql>select isauuid(uuid());
+-------+
| L2 |
+=======+
| true |
+-------+
1 tuple
sql>-- returns true
sql>select isauuid('aee1a538-aca1-381b-d9f4-8c29ef3f5f34');
+-------+
| L2 |
+=======+
| true |
+-------+
1 tuple
sql>-- returns true
sql>select isauuid('AEE1A538-ACA1-381B-D9F4-8C29EF3F5F34');
+-------+
| L2 |
+=======+
| true |
+-------+
1 tuple
sql>-- returns true
sql>select isauuid(null);
+-------+
| L2 |
+=======+
| false |
+-------+
1 tuple
sql>-- returns false
sql>select cast('aee1a538-aca1-381b-d9f4-8c29ef3f5f34' as uuid);
+--------------------------------------+
| L2 |
+======================================+
| aee1a538-aca1-381b-d9f4-8c29ef3f5f34 |
+--------------------------------------+
1 tuple
sql>select cast('AEE1A538-ACA1-381B-D9F4-8C29EF3F5F34' as uuid);
+--------------------------------------+
| L2 |
+======================================+
| aee1a538-aca1-381b-d9f4-8c29ef3f5f34 |
+--------------------------------------+
1 tuple
sql>
sql>-- test which correctly returns an error
sql>select cast('XYZaee1a538-aca1-381b-d9f4-8c29ef3f5' as uuid);
Not a UUID
sql>-- returns: Not a UUID
sql>

Expected Results:

first 4 queries should have returned "false" instead of "GDK reported error: Syntax error in UUID."

Comment 27405

Date: 2019-11-12 13:20:15 +0100
From: MonetDB Mercurial Repository <>

Changeset ed5e115fce8c made by Panagiotis Koutsourakis kutsurak@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=ed5e115fce8c

Changeset description:

Add test for bug #6784

Comment 27406

Date: 2019-11-12 13:20:19 +0100
From: MonetDB Mercurial Repository <>

Changeset 0f82f07884db made by Panagiotis Koutsourakis kutsurak@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=0f82f07884db

Changeset description:

UUIDfromString should not produce a GDKError

This fixes bug #6784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant