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

Error: SELECT: no such binary operator 'like(varchar,varchar)' when used in query running in other schema than sys #4062

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: 2016-09-01 15:13:51 +0200
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: -- development
CC: @njnes

Last updated: 2016-10-13 11:43:22 +0200

Comment 22344

Date: 2016-09-01 15:13:51 +0200
From: Martin van Dinther <<martin.van.dinther>>

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

like produces error when you execute a query in a schema other than sys and the like operator is used in the select-list.

Reproducible: Always

Steps to Reproduce:

  1. Start mserver5 ()
  2. Start mclient
  3. run SQL commands:
    set schema sys;

SELECT cast(CASE WHEN "columns"."default" IS NOT NULL AND "columns"."default" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS "IS_AUTOINCREMENT"
FROM "sys"."columns"
WHERE "columns"."default" LIKE 'next value for %';

set schema tmp;

SELECT cast(CASE WHEN "columns"."default" IS NOT NULL AND "columns"."default" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS "IS_AUTOINCREMENT"
FROM "sys"."columns"
WHERE "columns"."default" LIKE 'next value for %';

set schema profiler;

SELECT cast(CASE WHEN "columns"."default" IS NOT NULL AND "columns"."default" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS "IS_AUTOINCREMENT"
FROM "sys"."columns"
WHERE "columns"."default" LIKE 'next value for %';

Actual Results:

sql>set schema sys;
auto commit mode: on
sql>
sql>SELECT cast(CASE WHEN "columns"."default" IS NOT NULL AND "columns"."default" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS "IS_AUTOINCREMENT"
more>FROM "sys"."columns"
more>WHERE "columns"."default" LIKE 'next value for %';
+------------------+
| IS_AUTOINCREMENT |
+==================+
+------------------+
0 tuples (2.503ms)
sql>
sql>set schema tmp;
auto commit mode: on
sql>
sql>SELECT cast(CASE WHEN "columns"."default" IS NOT NULL AND "columns"."default" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS "IS_AUTOINCREMENT"
more>FROM "sys"."columns"
more>WHERE "columns"."default" LIKE 'next value for %';
SELECT: no such binary operator 'like(varchar,varchar)'
sql>
sql>set schema profiler;
auto commit mode: on
sql>
sql>SELECT cast(CASE WHEN "columns"."default" IS NOT NULL AND "columns"."default" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS "IS_AUTOINCREMENT"
more>FROM "sys"."columns"
more>WHERE "columns"."default" LIKE 'next value for %';
SELECT: no such binary operator 'like(varchar,varchar)'
sql>

Expected Results:

sql>set schema sys;
auto commit mode: on
sql>
sql>SELECT cast(CASE WHEN "columns"."default" IS NOT NULL AND "columns"."default" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS "IS_AUTOINCREMENT"
more>FROM "sys"."columns"
more>WHERE "columns"."default" LIKE 'next value for %';
+------------------+
| IS_AUTOINCREMENT |
+==================+
+------------------+
0 tuples (2.503ms)
sql>
sql>set schema tmp;
auto commit mode: on
sql>
sql>SELECT cast(CASE WHEN "columns"."default" IS NOT NULL AND "columns"."default" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS "IS_AUTOINCREMENT"
more>FROM "sys"."columns"
more>WHERE "columns"."default" LIKE 'next value for %';
+------------------+
| IS_AUTOINCREMENT |
+==================+
+------------------+
0 tuples (2.503ms)
sql>
sql>set schema profiler;
auto commit mode: on
sql>
sql>SELECT cast(CASE WHEN "columns"."default" IS NOT NULL AND "columns"."default" LIKE 'next value for %' THEN 'YES' ELSE 'NO' END AS varchar(3)) AS "IS_AUTOINCREMENT"
more>FROM "sys"."columns"
more>WHERE "columns"."default" LIKE 'next value for %';
+------------------+
| IS_AUTOINCREMENT |
+==================+
+------------------+
0 tuples (2.503ms)
sql>

The issue is introduced recently in default branch. 3 weeks ago (and in Jun2016 release) this SQL syntax worked.

This query scenario is used in in MonetDB JDBC driver getColumns() implementation, so it is important this is fixed asap.

Comment 22345

Date: 2016-09-01 15:20:48 +0200
From: MonetDB Mercurial Repository <>

Changeset 5e2066630c3f made by Martin van Dinther martin.van.dinther@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=5e2066630c3f

Changeset description:

Add test for Bug #4062

Comment 22353

Date: 2016-09-04 17:14:54 +0200
From: @njnes

fixed, we now use the proper sys schema when we lookup the (i)like functions

Comment 24502

Date: 2016-10-13 10:04:48 +0200
From: @sjoerdmullender

Jun2016-SP2 has been released.

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