Guest User

Untitled

a guest
Mar 10th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.79 KB | None | 0 0
  1. WITH RECURSIVE bank(id,amount) AS (
  2.   SELECT ARRAY[id],amount::NUMERIC FROM bank_transactions
  3.   UNION ALL
  4.   SELECT b1.id||ARRAY[borg.id],b1.amount+borg.amount
  5.   FROM bank AS b1 LEFT JOIN
  6.   bank_transactions AS borg ON borg.id>ALL(b1.id)
  7. )
  8. SELECT * FROM bank LIMIT 100;
  9.  
  10. ERROR:  recursive query "bank" COLUMN 2 has TYPE NUMERIC(20,2) IN non-recursive term but TYPE NUMERIC overall
  11. LINE 6:   SELECT ARRAY[id],amount::NUMERIC FROM bank_transactions
  12.                            ^
  13. HINT:  CAST the output OF the non-recursive term TO the correct TYPE.
  14.  
  15. ********** Error **********
  16.  
  17. ERROR: recursive query "bank" COLUMN 2 has TYPE NUMERIC(20,2) IN non-recursive term but TYPE NUMERIC overall
  18. SQL state: 42804
  19. Hint: CAST the output OF the non-recursive term TO the correct TYPE.
  20. CHARACTER: 140
Advertisement
Add Comment
Please, Sign In to add comment