Open
Description
Version
1.24.0
What happened?
A bug happened!
Relevant log output
column "elem" does not exist
Database schema
CREATE TABLE IF NOT EXISTS wallet_tmp (
mobile VARCHAR PRIMARY KEY, -- 手机号码
tickets JSONB NOT NULL default '[]' -- 我的票夹
);
SQL queries
-- name: RemoveTicketFromWalletTmp :exec
WITH elements AS (
SELECT (index-1)::INT AS idx
FROM wallet_tmp,
jsonb_array_elements(tickets) WITH ORDINALITY arr(elem, index)
WHERE mobile = $1
AND elem->>'ticket_no' = $2
)
UPDATE wallet_tmp
SET tickets = tickets - elements.idx
FROM elements
WHERE wallet_tmp.mobile = $1;
Configuration
No response
Playground URL
No response
What operating system are you using?
No response
What database engines are you using?
No response
What type of code are you generating?
No response