I want to execute the following query in my Postgresql 8.3 but gives error:
ERROR: could not find array type for data type numeric[]
When i googled, no result.
SELECT
*
FROM (
SELECT
*
FROM(
SELECT
ARRAY(
(SELECT
(SELECT
-- The problem is here
ARRAY[sum(borc_alacak[1]), 0.0] as kalantutar
-- if the line is not an array: "sum(borc_alacak[1]) as kalantutar" no problem. But, i need more results in an array.
FROM (
SELECT
fat.xxx as borc_alacak, fat.vadetarihi
FROM scf_fatura fat
WHERE yyy
UNION ALL
SELECT
fissiz.xxx as borc_alacak, fissiz.vadetarihi
FROM scf_odeme_fissiz fissiz
WHERE yyy
) as ignore
WHERE vadetarihi <= tarihler[2] AND vadetarihi >= tarihler[1]
) as kalantutar
FROM (
SELECT ARRAY[column1, column2] as tarihler FROM
( VALUES ('2009-05-29'::date, '2999-01-01'::date) ,
('2009-05-01'::date, '2009-05-28'::date) , ('2009-04-01'::date, '2009-04-30'::date) ,
('2009-03-01'::date, '2009-03-31'::date) , ('2009-02-01'::date, '2009-02-28'::date) ,
('2009-01-01'::date, '2009-01-31'::date) , ('2008-12-01'::date, '2008-12-31'::date) , ('2008-11-01'::date, '2008-11-30'::date) ,
('1899-01-01'::date, '2008-10-31'::date) ) as foo
) as ddd
)
) as tutarlar,
cari.*
FROM scf_carikart cari
WHERE cari.carikartkodu like '%DENEME%'
) as ignore
) AS ST
------------------
Some parts of the sql is automatically generated. Lots of tables so i do not attached their structure.
It should be easy to find the problem.
Thanks in advance
Suha