Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE bank_transactions
- (
- id serial NOT NULL,
- transaction_date DATE,
- amount NUMERIC(20,2),
- customer_id INTEGER NOT NULL,
- deleted BOOLEAN DEFAULT FALSE,
- CONSTRAINT bank_transactions_pkey PRIMARY KEY (id )
- );
- WITH RECURSIVE bank(id,amount) AS (
- SELECT ARRAY[id],amount::NUMERIC FROM bank_transactions
- UNION ALL
- SELECT b1.id||ARRAY[borg.id],b1.amount+borg.amount
- FROM bank AS b1 LEFT JOIN
- bank_transactions AS borg ON borg.id>ALL(b1.id)
- )
- SELECT * FROM bank LIMIT 100;
- ERROR: recursive query "bank" COLUMN 2 has TYPE NUMERIC(20,2) IN non-recursive term but TYPE NUMERIC overall
- LINE 6: SELECT ARRAY[id],amount::NUMERIC FROM bank_transactions
- ^
- HINT: CAST the output OF the non-recursive term TO the correct TYPE.
- ********** Error **********
- ERROR: recursive query "bank" COLUMN 2 has TYPE NUMERIC(20,2) IN non-recursive term but TYPE NUMERIC overall
- SQL state: 42804
- Hint: CAST the output OF the non-recursive term TO the correct TYPE.
- CHARACTER: 140
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement