#postgres, asyncpg, DatatypeMismatchError argument of AND must be type boolean, not type bigint
32 messages · Page 1 of 1 (latest)
i mean they should be right, lemme check the types
I think it's upset about channel = $2
i dont see how
<class 'discord.channel.TextChannel'> # channel
<class 'str'> # username
<class 'str'> # message
(
guild BIGINT PRIMARY KEY,
channel BIGINT NOT NULL,
username TEXT NOT NULL,
message TEXT NOT NULL
)
``` this is my table, nothings wrong with this right?
It's talking about the AND
So it is an issue with the query syntax. Put channel = $2 in parentheses
alr
shall i do that with the other ones?
asyncpg.exceptions.PostgresSyntaxError: syntax error at or near "="
What did you change the query to
INSERT INTO twitch_config (guild, channel, username, message) VALUES ($1, $2, $3, $4)
ON CONFLICT (guild) DO UPDATE SET (channel = $2) AND username = $3 AND message = $4 WHERE twitch_config.guild = $1
Get rid of the spaces around the =
for all of them?
still dosent work
very weird
im pretty sure ive had this issue before
2 mins
#831374198432989194 message
Wait, put parentheses around the entire condition.
DO UPDATE SET (Channel = $2 AND username = $3 AND message $4 WHERE twitch_config.guild = $1)
alr
this works btw
and this gives the same error
: asyncpg.exceptions.PostgresSyntaxError: syntax error at or near "="
Oh yeah this is a set not a condition. You can't use AND outside of a condition or boolean logic. Use commas when setting.
ah, i didnt know that
i should probably learn sql outside of making my bot, would help me know things like that lmao