ERROR: 42883: operator does not exist: jsonb ~~ character varying

Posts   
 
    
khorvat avatar
khorvat
User
Posts: 65
Joined: 17-Feb-2011
# Posted on: 26-Jun-2017 17:54:08   

Hi,

we have the following error: "ERROR: 42883: operator does not exist: jsonb ~~ character varying" when we try to use Like on JsonB on PostgreSQL.

We have filter similar to this:


...
bucket.PredicateExpression.Add(MyFields.Data % String.Format("%{0}%", filter.SearchPhrase));
...


"Details": "An exception was caught during the execution of a retrieval query: ERROR: 42883: operator does not exist: jsonb ~~ character varying. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.",
    "Error": {
        "_queryExecuted": "\r\n\tQuery: SELECT COUNT(\"public\".\"Item\".\"Id\") AS \"Id\" FROM \"public\".\"Item\" WHERE ( \"public\".\"Item\".\"SectionName\" = :p1 AND \"public\".\"Item\".\"Data\" LIKE :p2) LIMIT 1\r\n\tParameter: :p1 : String. Length: 255. Precision: 0. Scale: 0. Direction: Input. Value: \"projects\".\r\n\tParameter: :p2 : String. Length: 3. Precision: 0. Scale: 0. Direction: Input. Value: \"%t%\".\r\n",
        "_exceptionInfo": {
            "ErrorCode": -2147467259,
            "Message": "ERROR: 42883: operator does not exist: jsonb ~~ character varying",
            "HelpLink": null,
            "ErrorObjects": [

...

                    "ErrorSql": "SELECT COUNT(\"public\".\"Item\".\"Id\") AS \"Id\" FROM \"public\".\"Item\" WHERE ( \"public\".\"Item\".\"SectionName\" = (('projects')::varchar(255)) AND \"public\".\"Item\".\"Data\" LIKE (('%t%')::text)) LIMIT 1"

It seems to me that issue is related to the following line not being cast to "::text"

"public\".\"Item\".\"Data\" LIKE (('%t%')::text)

Do you have any idea why this is not cast to "text" once we use like on this field? We have same functionality in EF and it's working properly.

We are using LLBLGen 4.2, Low-Level API

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Jun-2017 18:09:55   

Might be related to npgsql, you do use a recent v3 build of npgsql?

Frans Bouma | Lead developer LLBLGen Pro
khorvat avatar
khorvat
User
Posts: 65
Joined: 17-Feb-2011
# Posted on: 14-Jul-2017 10:11:54   

I am trying to get the Npgsql 3.2.3 inside the LLBLGen 4.2 and having some issues (I have opened another issue), so I didn't test it with latest v3.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 14-Jul-2017 11:00:14   

Replied on the other issue. Closing this for now till v3.2.3 or higher is used for testing

Frans Bouma | Lead developer LLBLGen Pro