@@ -1376,5 +1376,48 @@ END;
13761376 },
13771377 },
13781378 },
1379+ {
1380+ Name : "resolve type with empty search path" ,
1381+ SetUpScript : []string {
1382+ "set search_path to ''" ,
1383+ `CREATE TABLE public.ambienttempdetail (tempdetailid integer NOT NULL, panelprojectid integer, threshold_value numeric(10,2), readingintervalinmin integer);` ,
1384+ `insert into public.ambienttempdetail values (1, 101, 25.5, 15);` ,
1385+ },
1386+ Assertions : []ScriptTestAssertion {
1387+ {
1388+ Query : `CREATE FUNCTION public.ambienttempdetail_insertupdate(p_panel_project_id integer, p_threshold_value numeric, p_reading_interval_in_min integer) RETURNS integer
1389+ LANGUAGE plpgsql
1390+ AS $$
1391+ DECLARE
1392+ v_rtn_value INTEGER;
1393+ BEGIN
1394+ IF NOT EXISTS (SELECT * FROM AmbientTempDetail WHERE PanelProjectId = p_panel_project_id) THEN
1395+ INSERT INTO AmbientTempDetail (PanelProjectId, Threshold_Value, ReadingIntervalInMin)
1396+ VALUES (p_panel_project_id, p_threshold_value, p_reading_interval_in_min)
1397+ RETURNING TempDetailId INTO v_rtn_value;
1398+ ELSE
1399+ UPDATE AmbientTempDetail
1400+ SET PanelProjectId = p_panel_project_id,
1401+ Threshold_Value = p_threshold_value,
1402+ ReadingIntervalInMin = p_reading_interval_in_min
1403+ WHERE PanelProjectId = p_panel_project_id;
1404+ v_rtn_value := p_panel_project_id;
1405+ END IF;
1406+
1407+ RETURN v_rtn_value;
1408+ END;
1409+ $$;` ,
1410+ Expected : []sql.Row {},
1411+ },
1412+ {
1413+ Query : "set search_path to 'public'" ,
1414+ },
1415+ {
1416+ Skip : true ,
1417+ Query : "SELECT public.ambienttempdetail_insertupdate(101, 25.5, 15);" ,
1418+ Expected : []sql.Row {{101 }},
1419+ },
1420+ },
1421+ },
13791422 })
13801423}
0 commit comments