Обсуждение: pgAdmin debugger failure when search_path set
Hi Dave/Team,
I've been working on an issue to make debugger work no matter what the search patch is set. I've managed to call the appropriate functions from pgAdmin using a schema qualified name with no issues. However, the internal calls in the function don't look schema qualified.
For instance,
I have two schemas "public" where the debugger is installed and "other" where my user defined function is. I set the search_path to "other" on the database. Calling plpgsql_oid_debug directly fails because of the search path set, but I can call the debugger functions with public.plpgsql_oid_debug, but it fails with:
ERROR: function pldbg_oid_debug(oid) does not exist LINE 1: SELECT pldbg_oid_debug($1) ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. QUERY: SELECT pldbg_oid_debug($1) CONTEXT: SQL function "plpgsql_oid_debug" during inlining
How to approach this ? It is inconvenient for users to remove their search_path to make debugger work.
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"
Hi Aditya
On Thu, Aug 6, 2020 at 4:48 PM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Dave/Team,I've been working on an issue to make debugger work no matter what the search patch is set. I've managed to call the appropriate functions from pgAdmin using a schema qualified name with no issues. However, the internal calls in the function don't look schema qualified.For instance,I have two schemas "public" where the debugger is installed and "other" where my user defined function is. I set the search_path to "other" on the database. Calling plpgsql_oid_debug directly fails because of the search path set, but I can call the debugger functions with public.plpgsql_oid_debug, but it fails with:ERROR: function pldbg_oid_debug(oid) does not exist LINE 1: SELECT pldbg_oid_debug($1) ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. QUERY: SELECT pldbg_oid_debug($1) CONTEXT: SQL function "plpgsql_oid_debug" during inliningHow to approach this ? It is inconvenient for users to remove their search_path to make debugger work.
To solve the above problem I would suggest, get the existing search path and append 'public' in that and set it only for the Debugger session and reset back when a debugger is closed.
--Thanks,Aditya ToshniwalpgAdmin hacker | Sr. Software Engineer | edbpostgres.com"Don't Complain about Heat, Plant a TREE"
--
Thanks & Regards
Akshay Joshi
pgAdmin Hacker | Sr. Software Architect
EDB PostgresMobile: +91 976-788-8246
Hi Akshay,
On Tue, Aug 11, 2020 at 12:13 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi AdityaOn Thu, Aug 6, 2020 at 4:48 PM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:Hi Dave/Team,I've been working on an issue to make debugger work no matter what the search patch is set. I've managed to call the appropriate functions from pgAdmin using a schema qualified name with no issues. However, the internal calls in the function don't look schema qualified.For instance,I have two schemas "public" where the debugger is installed and "other" where my user defined function is. I set the search_path to "other" on the database. Calling plpgsql_oid_debug directly fails because of the search path set, but I can call the debugger functions with public.plpgsql_oid_debug, but it fails with:ERROR: function pldbg_oid_debug(oid) does not exist LINE 1: SELECT pldbg_oid_debug($1) ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. QUERY: SELECT pldbg_oid_debug($1) CONTEXT: SQL function "plpgsql_oid_debug" during inliningHow to approach this ? It is inconvenient for users to remove their search_path to make debugger work.To solve the above problem I would suggest, get the existing search path and append 'public' in that and set it only for the Debugger session and reset back when a debugger is closed.
Good idea !! I'll give a try.
--Thanks,Aditya ToshniwalpgAdmin hacker | Sr. Software Engineer | edbpostgres.com"Don't Complain about Heat, Plant a TREE"
--Thanks & RegardsAkshay JoshipgAdmin Hacker | Sr. Software ArchitectEDB PostgresMobile: +91 976-788-8246
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"
Hi Hackers,
Attached is the patch for RM4123, where debugger doesn't work if the search path is set other than public(where the debugger extension is installed). Now the schema public is appended to the existing search path and it will now work no matter what the search path is.
I've also renamed the directory "v2" in templates to "v3". Reason being, the directory is used for debugger version 3 and above.
Please review.
On Tue, Aug 11, 2020 at 12:17 PM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Akshay,On Tue, Aug 11, 2020 at 12:13 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:Hi AdityaOn Thu, Aug 6, 2020 at 4:48 PM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:Hi Dave/Team,I've been working on an issue to make debugger work no matter what the search patch is set. I've managed to call the appropriate functions from pgAdmin using a schema qualified name with no issues. However, the internal calls in the function don't look schema qualified.For instance,I have two schemas "public" where the debugger is installed and "other" where my user defined function is. I set the search_path to "other" on the database. Calling plpgsql_oid_debug directly fails because of the search path set, but I can call the debugger functions with public.plpgsql_oid_debug, but it fails with:ERROR: function pldbg_oid_debug(oid) does not exist LINE 1: SELECT pldbg_oid_debug($1) ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. QUERY: SELECT pldbg_oid_debug($1) CONTEXT: SQL function "plpgsql_oid_debug" during inliningHow to approach this ? It is inconvenient for users to remove their search_path to make debugger work.To solve the above problem I would suggest, get the existing search path and append 'public' in that and set it only for the Debugger session and reset back when a debugger is closed.Good idea !! I'll give a try.--Thanks,Aditya ToshniwalpgAdmin hacker | Sr. Software Engineer | edbpostgres.com"Don't Complain about Heat, Plant a TREE"
--Thanks & RegardsAkshay JoshipgAdmin Hacker | Sr. Software ArchitectEDB PostgresMobile: +91 976-788-8246--Thanks,Aditya ToshniwalpgAdmin hacker | Sr. Software Engineer | edbpostgres.com"Don't Complain about Heat, Plant a TREE"
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"