Thread: Can't get the debugger going

Can't get the debugger going

From
Raymond O'Donnell
Date:
Hi all,

As the subject line says..... I've downloaded PG 8.3 (Win32) and 
included the pl/pgsql debugger in the installation options; I've also 
upgraded PgAdmin to 1.8.2. I checked that the debugger files were there, 
and they are - C:\Program Files\PostgreSQL\8.3\lib\plugins contains 
plugin_debugger.dll and plugin_profiler.dll; and I even added this 
folder to the PATH.

However, Tools -> Debugging remains greyed out, and the "Debug" items 
which the help says ought to appear on the contect menu for functions 
isn't there.

What am I missing?

TIA,

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------


Re: Can't get the debugger going

From
"Dave Page"
Date:
On Feb 4, 2008 4:13 PM, Raymond O'Donnell <rod@iol.ie> wrote:
> Hi all,
>
> As the subject line says..... I've downloaded PG 8.3 (Win32) and
> included the pl/pgsql debugger in the installation options; I've also
> upgraded PgAdmin to 1.8.2. I checked that the debugger files were there,
> and they are - C:\Program Files\PostgreSQL\8.3\lib\plugins contains
> plugin_debugger.dll and plugin_profiler.dll; and I even added this
> folder to the PATH.
>
> However, Tools -> Debugging remains greyed out, and the "Debug" items
> which the help says ought to appear on the contect menu for functions
> isn't there.
>
> What am I missing?

Are you trying to debug a function that isn't written in pl/pgsql?
Also, make sure the debugger functions are loaded in the database you
wish to debug - if you've restored a dump into a database created form
template0, they might not be (there should be an sql script in the
server's share directory).

/D


Re: Can't get the debugger going

From
Raymond O'Donnell
Date:
On 04/02/2008 16:38, Dave Page wrote:
> Also, make sure the debugger functions are loaded in the database you
> wish to debug - if you've restored a dump into a database created form
> template0, they might not be (there should be an sql script in the
> server's share directory).

That did the job - I had done a pg_dumpall/psql reload, which created 
all the databases from template0.

Thanks!

Ray.


---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------


Re: Can't get the debugger going

From
William Garrison
Date:
>
> On Feb 4, 2008 4:13 PM, Raymond O'Donnell <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > As the subject line says..... I've downloaded PG 8.3 (Win32) and
> > included the pl/pgsql debugger in the installation options; I've also
> > upgraded PgAdmin to 1.8.2. I checked that the debugger files were there,
> > and they are - C:\Program Files\PostgreSQL\8.3\lib\plugins contains
> > plugin_debugger.dll and plugin_profiler.dll; and I even added this
> > folder to the PATH.
> >
> > However, Tools -> Debugging remains greyed out, and the "Debug" items
> > which the help says ought to appear on the contect menu for functions
> > isn't there.
> >
> > What am I missing?
>
> Are you trying to debug a function that isn't written in pl/pgsql?
> Also, make sure the debugger functions are loaded in the database you
> wish to debug - if you've restored a dump into a database created form
> template0, they might not be (there should be an sql script in the
> server's share directory).
I found this thread and it is the same symptom I have.  I have the same 
plugins as well.  But I don't understand the suggestions.

I have a database that I created from scratch, not using dump/restore.  
I also tried creating a simple function in the "postgres" database and I 
cannot debug that either.  What "debugger functions" are you referring 
to?  What is "template0"?  (I see it in pgadmin but I can't connect to 
it so I don't know what that is.  I also have a "template1").


Re: Can't get the debugger going

From
schatz
Date:
I have the same problem, debugger option is disabled & have the
plugin_debugger & profiler.dll in the lib directory. I don't know how to do
pg)dumpall/psql_reload from pgadmin3. Can u pls. help me out how to do this.
How do I make sure debugger funcions are loaded in my dbase?
Thank you.
schatz


Raymond O'Donnell wrote:
> 
> On 04/02/2008 16:38, Dave Page wrote:
>> Also, make sure the debugger functions are loaded in the database you
>> wish to debug - if you've restored a dump into a database created form
>> template0, they might not be (there should be an sql script in the
>> server's share directory).
> 
> That did the job - I had done a pg_dumpall/psql reload, which created 
> all the databases from template0.
> 
> Thanks!
> 
> Ray.
> 
> 
> ---------------------------------------------------------------
> Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
> rod@iol.ie
> ---------------------------------------------------------------
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
> 
> 

-- 
View this message in context: http://www.nabble.com/Can%27t-get-the-debugger-going-tp15271521p23017680.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.



Re: Can't get the debugger going

From
Raymond O'Donnell
Date:
On 13/04/2009 05:09, schatz wrote:
> I have the same problem, debugger option is disabled & have the
> plugin_debugger & profiler.dll in the lib directory. I don't know how to do
> pg)dumpall/psql_reload from pgadmin3. Can u pls. help me out how to do this.
> How do I make sure debugger funcions are loaded in my dbase?

You don't use pgAdmin for these; use pg_dumpall and psql themselves
instead. PgAdmin just lets you do per-database dumps and reloads.

Look in the docs under "Client applications" for examples of how to use
pg_dumpall and psql.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------


Re: Can't get the debugger going

From
Raymond O'Donnell
Date:
On 13/04/2009 13:15, Raymond O'Donnell wrote:
> On 13/04/2009 05:09, schatz wrote:
>> I have the same problem, debugger option is disabled & have the
>> plugin_debugger & profiler.dll in the lib directory. I don't know how to do
>> pg)dumpall/psql_reload from pgadmin3. Can u pls. help me out how to do this.
>> How do I make sure debugger funcions are loaded in my dbase?
> 
> You don't use pgAdmin for these; use pg_dumpall and psql themselves
> instead. PgAdmin just lets you do per-database dumps and reloads.

....and I meant to add that to reload the debugger functions, you do
something like this:
 psql -f pldbgapi.sql <your_database>

The file pldbgapi.sql should be in the share/contrib directory. If you
want to have the functions loaded be default into every new database you
create, install them into template1.

HTH,

Ray.


------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------


Re: Can't get the debugger going

From
Raymond O'Donnell
Date:
[Redirecting to the list]

On 13/04/2009 16:33, gaybana2000@hotmail.com wrote:
> Thank you for your reply. I only have pgadmin3 installed. where do I
> run these commands from. what do I need to install to rund these
> command line commands?

What platform are you on? Also, what exactly are you trying to do?

> I looked in the docs for how to use the
> pg_dumpall commands...don't know where to run these commands.

You just run them at the system command line... if you're on Windows, go
to Start -> Run and type 'cmd' to bring up a command prompt. Of course,
you need to have these utilities installed in the first place - how you
do this depends on your platform.

> I also don't have template1 dbase.

I think pgAdmin hides it by default. To see it (and a lot of other
stuff), go to File -> Options -> Display, and check "Show system objects
in the treeview"; then refresh the "Databases" node of the treeview by
clicking on it and pressing F5.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------


Re: Can't get the debugger going

From
schatz
Date:
- I enabled the option "Show system objects in the treeview" to see the
templates and this is done, thank you.Templates don't have any functions in
them?

- My platform is win XP. I created three schemas, each have different
tables. One schema will create a table with the data from the other tables
that resides in other two schemas. I need to write a cursor-loop-fetch
function to extract data from some fields from the two schemas and insert
into a new table in the third schema...I wrote a test function but can't
debug it and not sure if I should use sql or pl/pgsql.  

This is a copy from Function treeview, not sure why it writes two headers
and adds more stuff to the bottom.
-- Function: "MySchema".create_data()

-- DROP FUNCTION "MySchema".create_data();

CREATE OR REPLACE FUNCTION "MySchema".create_data() RETURNS void AS
$BODY$CREATE FUNCTION "MySchema".create_data() RETURNS varchar(3) AS '

DECLARE   
my_cursor CURSOR for select prov from "SecondSchema".data_load;
province varchar(3);   
BEGIN      open my_cursor; RAISE info ''prov'';     RAISE INFO ''-----'';      LOOP          FETCH my_cursor INTO
province;         RAISE INFO ''%'', province;          EXIT WHEN my_cursor%NOT FOUND;        RAISE INFO ''%'',
province;     END LOOP;      CLOSE my_cursor;     return province; 
 
END; 
'LANGUAGE 'plpgsql';
$BODY$ LANGUAGE 'sql' VOLATILE COST 100;
ALTER FUNCTION "MySchema".create_data() OWNER TO postgres;


- I tried to install the debugger by running the command you recommended in
the cmd window. Now when I run "C:...PostgreSQL\8.3\share\contrib\psql -f
pldbgapi.sql my_dbase" it says: "psql is not recognized as an internal or
external command, operable or batch file" Is that mean I don't have psql.exe
installed? I see it under the bin folder, when I run it from the cmd line it
asks me for a password. I tried the password for windows and postgresql both
don't work.
Schatz.



Raymond O'Donnell wrote:
> 
> [Redirecting to the list]
> 
> On 13/04/2009 16:33, gaybana2000@hotmail.com wrote:
>> Thank you for your reply. I only have pgadmin3 installed. where do I
>> run these commands from. what do I need to install to rund these
>> command line commands?
> 
> What platform are you on? Also, what exactly are you trying to do?
> 
>> I looked in the docs for how to use the
>> pg_dumpall commands...don't know where to run these commands.
> 
> You just run them at the system command line... if you're on Windows, go
> to Start -> Run and type 'cmd' to bring up a command prompt. Of course,
> you need to have these utilities installed in the first place - how you
> do this depends on your platform.
> 
>> I also don't have template1 dbase.
> 
> I think pgAdmin hides it by default. To see it (and a lot of other
> stuff), go to File -> Options -> Display, and check "Show system objects
> in the treeview"; then refresh the "Databases" node of the treeview by
> clicking on it and pressing F5.
> 
> Ray.
> 
> ------------------------------------------------------------------
> Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
> rod@iol.ie
> Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
> ------------------------------------------------------------------
> 
> -- 
> Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-support
> 
> 

-- 
View this message in context: http://www.nabble.com/Can%27t-get-the-debugger-going-tp15271521p23025672.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.



Re: Can't get the debugger going

From
Raymond O'Donnell
Date:
On 13/04/2009 18:27, schatz wrote:
> - I enabled the option "Show system objects in the treeview" to see the
> templates and this is done, thank you.Templates don't have any functions in
> them?

Not unless you put them there. They really are "templates" - when you
create a new database, it's created as a copy of template1 (in fact, you
can use any database as a template, but the default is template1), and
template0 is there to recreate template1 is you somehow mess up the latter.

> - My platform is win XP. I created three schemas, each have different
> tables. One schema will create a table with the data from the other tables
> that resides in other two schemas. I need to write a cursor-loop-fetch
> function to extract data from some fields from the two schemas and insert
> into a new table in the third schema...I wrote a test function but can't
> debug it and not sure if I should use sql or pl/pgsql.  

Well, pl/pgsql gives you all the expressiveness you'd expect of a
procedural language, whereas SQL is just, well, SQL. :-) Use pl/pgsql if
you need all the control structures, etc, but be aware that there is
some performance penalty when the language is loaded at runtime.

> This is a copy from Function treeview, not sure why it writes two headers
> and adds more stuff to the bottom.

Define "more stuff".

> CREATE OR REPLACE FUNCTION "MySchema".create_data()
>   RETURNS void AS
> $BODY$CREATE FUNCTION "MySchema".create_data() RETURNS varchar(3) AS '

[snip]

You've got something really weird here - you've got an SQL function
which creates a pl/pgsql function! You don't need the outer SQL
function. Also, use dollar-quoting in the function definition; it saves
you having to double up all the apostrophes. Something like this:
 create or replace function "MySchema".create_data() returns varchar(3) as $$ declare   .... begin   ....   raise info
'prov';  raise info '----';   .... end; $$ language plpgsql;
 

> - I tried to install the debugger by running the command you recommended in
> the cmd window. Now when I run "C:...PostgreSQL\8.3\share\contrib\psql -f
> pldbgapi.sql my_dbase" it says: "psql is not recognized as an internal or
> external command, operable or batch file" Is that mean I don't have psql.exe
> installed? I see it under the bin folder,

As you say, it's in the bin directory, so you have to supply that path
to Windows when you run it:
 c:\...\8.3\bin\psql -f c:\...\8.3\share\pldbgapi.sql my_dbase

You might have to double-quote the paths if they have spaces.

> when I run it from the cmd line it
> asks me for a password. I tried the password for windows and postgresql both
> don't work.

In that case, you have to specify the PostgreSQL user (not the Windows
user) as which you want to connect, and then it's the password for that
user you have to supply. Add the -U option to the command line above:
 "c:\...\psql" -f "c:\...\pldbgapi.sql" -U [postgres user] my_dbase

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------