I've been running a scheduled task that contains some SQL code that has been running fine up until a few weeks ago. I don't believe any of the code had changed recently so I went through the debugger and found the following.
The portion of code that fails:
Execute 'create table ab_appl_lines as select gid, disp_num, degrees(st_Azimuth(st_astext(ST_Line_Interpolate_Point(ST_LineMerge(ST_Line_Substring(st_Boundary(the_geom), 0.01, 0.02)), 0.10)), st_astext(ST_Line_Interpolate_Point(ST_LineMerge(ST_Line_Substring(st_Boundary(the_geom), 0.01, 0.02)), 0.2)))) as an_angle,st_Boundary(the_geom) as the_geom from ab_appl where disp_type= ''EZE'' or disp_type= ''REA'' or disp_type= ''VCE'' or disp_type= ''EAS'' or disp_type= ''REC'' or disp_type= ''RDS'' or disp_type= ''RRD'' or disp_type= ''FRD'' or disp_type= ''ROW''or disp_type= ''ISP'' or disp_type= ''DRS'' or disp_type= ''PLA'' or disp_type= ''KRS'' or disp_type= ''LOC'' or disp_type= ''MLL'' or disp_type= ''MLP'' or disp_type= ''MSL'' or disp_type= ''MTS'' or disp_type= ''ROE'' or disp_type= ''PIL'' or disp_type= ''SML'' or disp_type= ''SMC'' or disp_type= ''SME''; alter table ab_appl_lines add primary key(gid);';
The error:
ERROR: line_interpolate_point: 1st arg isnt a line CONTEXT: SQL function "st_line_interpolate_point" statement 2 SQL statement "create table ab_appl_lines as select gid, disp_num, degrees(st_Azimuth(st_astext(ST_Line_Interpolate_Point(ST_LineMerge(ST_Line_Substring(st_Boundary(the_geom), 0.01, 0.02)), 0.10)), st_astext(ST_Line_Interpolate_Point(ST_LineMerge(ST_Line_Substring(st_Boundary(the_geom), 0.01, 0.02)), 0.2)))) as an_angle,st_Boundary(the_geom) as the_geom from ab_appl where disp_type= 'EZE' or disp_type= 'REA' or disp_type= 'VCE' or disp_type= 'EAS' or disp_type= 'REC' or disp_type= 'RDS' or disp_type= 'RRD' or disp_type= 'FRD' or disp_type= 'ROW'or disp_type= 'ISP' or disp_type= 'DRS' or disp_type= 'PLA' or disp_type= 'KRS' or disp_type= 'LOC' or disp_type= 'MLL' or disp_type= 'MLP' or disp_type= 'MSL' or disp_type= 'MTS' or disp_type= 'ROE' or disp_type= 'PIL' or disp_type= 'SML' or disp_type= 'SMC' or disp_type= 'SME'; alter table ab_appl_lines add primary key(gid);" PL/pgSQL function process_create_ab_appl_lines() line 4 at EXECUTE statement
ST_Line_Interpolate_Point
takes a linestring and a float as arguments and as far as I can tell that's what I'm passing in the code as ST_Line_Merge
? Am I missing something more here?