New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin_debugger and view record type #78
Comments
I made some changes to plpgsql_debugger.c in extension pldbgapi, |
Hello @cvas71, The best to integrate your modification is you make a pull request for both projects. Thank you for these modifications! |
I couldn't make a pull request. |
Yes that's the flow for project contribution
|
@cvas71 Your changes are committed and I've created a branch
|
Yes, I did not take into account that it is necessary to make sure that the changes will also be compatible with other versions of PostgreSQL. |
Good afternoon, Sir.
I am using your plugin_debugger (https://github.com/ng-galien/pldebugger) library built according to your instructions. I noticed that if in the declared variables there is a variable with the RECORD type, the debugging process ends with an error.
[55000] ERROR: record "v_record" is not assigned yet
The tuple structure of a not-yet-assigned record is indeterminate.
It's easy to check.
In your function, which goes for an example, added in the declaration
v_record RECORD;
and before RETURN
pasted the code
FOR v_record IN SELECT * FROM public.debug
LOOP
RAISE NOTICE '%', v_record.id;
END LOOP;
CREATE FUNCTION test_debug(p_text text, p_int integer DEFAULT 0) RETURNS text
LANGUAGE plpgsql
AS
$$
DECLARE
v_int_array INT[] = ARRAY [6, 7, 8];
v_custom public.custom_type = (434, 'Custom')::public.custom_type;
v_debug_array debug[];
v_debug debug;
v_text TEXT = '';
v_int INT = 0;
v_date DATE = NULL;
v_record RECORD;
BEGIN
v_text = p_text;
v_int_array = ARRAY_APPEND(v_int_array, p_int);
SELECT * FROM public.debug LIMIT 1 INTO v_debug;
v_int_array = ARRAY_APPEND(v_int_array, 3);
SELECT ARRAY_AGG(d) FROM public.debug d INTO v_debug_array;
v_int_array = ARRAY_APPEND(v_int_array, 5);
v_int_array = ARRAY_APPEND(v_int_array, 7);
v_text = 'TEST';
v_int = v_int + 1;
v_date = CURRENT_DATE;
SELECT ARRAY_AGG(id) FROM public.debug INTO v_int_array;
FOR v_record IN SELECT *
FROM public.debug
LOOP
RAISE NOTICE '%', v_record.id;
END LOOP;
END
$$;
The text was updated successfully, but these errors were encountered: