Inside a routine, a SELECT ... INTO statement that relies on a subquery does not work correctly. Example below was reported in the Open Discussion Forum
DECLARE newest_event_id UUID; SELECT id INTO newest_event_id -- THIS IS NEVER SET. WHY????? FROM ( SELECT e.id, td.datetime + INTERVAL '1' SECOND(6) * e.offset AS e_datetime FROM test_drive td ... ORDER BY e_datetime DESC LIMIT 1 ) AS tmp;
Diff: