Skip to content

No error when boolean is used to filter varchar column #2160

@angelamayxie

Description

@angelamayxie

The following query, with setup, executes in Doltgres (and gives the wrong result, an empty set) but produces an error in Postgres

SetUpScript: []string{
	"create table t1(c0 varchar(500), primary key(c0))",
	"insert into t1(c0) values ('')",
},
Assertions: []ScriptTestAssertion{
	{
		Query:    "select 1 from t1 where false=t1.c0",
		Expected: []sql.Row{{1}},
	},
},

postgres

postgres=# create table t1(c0 varchar(500), primary key(c0));
CREATE TABLE
postgres=# insert into t1(c0) values('');
INSERT 0 1
postgres=# select 1 from t1 where false=t1.c0;
ERROR:  operator does not exist: boolean = character varying
LINE 1: select 1 from t1 where false=t1.c0;
                                    ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

Discovered while fixing dolthub/dolt#10246

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions