Hello,
I have the following SQL query that works in Postgres 9.4 using pgAdmin or psql
SELECT *
FROM avrr_mroutecost (
array[('A1',(-13636312,5710537)),
('ABT1',(-13634114,5695273)),
('ABT10',(-13633029,5704870))]::avrr_unit[],
(-13643477,5699713),
'9920 SE BUSH ST',
500,
4000,
'CAD',
'CAD')
When I put that query in a Genero 3.0 program like this:
MAIN
DEFINE my_query STRING
CONNECT TO "gisdb"
LET my_query = "SELECT * FROM avrr_mroutecost ",
"( array[('A1',(-13636312,5710537)),",
" ('ABT1',(-13634114,5695273)),",
" ('ABT10',(-13633029,5704870))]::avrr_unit[],",
"(-13643477,5699713),",
"'9920 SE BUSH ST',500,4000,'CAD','CAD')"
EXECUTE IMMEDIATE my_query
END MAIN
The program fails with the following error:
Program stopped at 'gis.4gl', line number 13.
SQL statement error number -201 (-1).
syntax error at or near "from"Running the program with FGLSQLDEBUG set I see the query gets converted to:
4gl source : gis.4gl line=13
| pgs.c:01513(3) : Nat stmt1 = declare scu1 cursor WITH hold FOR SELECT * FROM avrr_mroutecost ( substring(array FROM ('A1' FOR ((-13636312,5710537)), ('ABT1',(-13634114,5695273)), ('ABT10',(-13633029,5704870)))-(('A1')+1)::substring(avrr_unit FROM FOR 1),(-13643477,5699713),'9920 SE BUSH ST',500,4000,'CAD','CAD')
Looks like the [] gets converted to substring by the ODI. Is there anyway to get around this and have the ODI not modify the query?
Thanks
Juan Pedro Martinez