0

I have a column in table with type character varying here is the query:

update logins 
set access_token='l38r8cfjm31b38ye91yjn1956vr3n74tc5sc0btholj0iain77' and uuid='123456789'  
where username = 'PWD_2006'

It give me the error:

ERROR: invalid input syntax for type boolean: "l38r8cfjm31b38ye91yjn1956vr3n74tc5sc0btholj0iain77"
LINE 1: update logins set access_token='l38r8cfjm31b38ye91yjn1956vr3... ^
SQL state: 22P02
Character: 32

1
  • 3
    Change and by a , (comma)
    – McNets
    Commented May 24, 2019 at 7:41

1 Answer 1

2

Your query is interpreted as

... SET access_token =
        ('l38r8cfjm31b38ye91yjn1956vr3n74tc5sc0btholj0iain77'
         and uuid='123456789')

That is, AND is treated as a logical operator, and the string constant is interpreted as a boolean literal, which causes the error.

Replace AND with , like the comment suggests.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.