Thread: Debugging Pl/PgSQL functions with the debug contrib module
Hello, I'm developing a large postgreSQL database front end application on win32. I'd consider the ability to debug Pl/PgSQL functions highly desirable. Until now, I've been using RAISE NOTICE debugging, which is equivalent to printf debugging, and is sub optimal. I am aware of the possibility of debugging Pl/PgSQL functions through edb-debugger. I am unable to get this to work. According to the PgAdmin III 1.8.2 documentation, "In order to use the debugger, a plugin is required on your server. This is included by default with EnterpriseDB, and is available for download on pgFoundry. It is installed as a contrib module with the Windows distribution of PostgreSQL 8.3 and above". When I recently installed postgreSQL 8.3.1 from the win32 MSI binary distribution, there was no reference to this contrib module. There was also no reference to it in the bundled "stack builder" application. What did I miss? It is not apparent to me how I can test for the absence or presence of this module within PgAdmin III. In the tools menu, there is a "debugging" tab, but it is disabled in all of the contexts that I've tried so far. I downloaded Lightning debugger, a tool that expressly debugs Pl/PgSQL. When I attempt to connect to my database, a message box appears: --------------------------- WARNING --------------------------- Debugger not supported: Database missing debugger API functions --------------------------- OK --------------------------- The only available on PgFoundry is a source distribution: http://pgfoundry.org/frs/?group_id=1000175 . Building this would necessitate setting up a mingw build environment, which would be a lot of effort. What is the simplest, most direct way of enabling debugging of Pl/PgSQL under these circumstances? Thanks, Peter Geoghegan
Peter Geoghegan wrote: > Hello, > > I'm developing a large postgreSQL database front end application on > win32. I'd consider the ability to debug Pl/PgSQL functions highly > desirable. Until now, I've been using RAISE NOTICE debugging, which is > equivalent to printf debugging, and is sub optimal. "Sub optimal" is the polite way of saying it :-) > It is installed as a contrib module with the Windows distribution of > PostgreSQL 8.3 and above". When I recently installed postgreSQL 8.3.1 > from the win32 MSI binary distribution, there was no reference to this > contrib module. There was also no reference to it in the bundled > "stack builder" application. What did I miss? It should be one of the optional items to install (like pl/perl or crypto etc) - there's a screen of tickboxes at some point during the install. I'd re-run the installer and see if it lets you add the module. Oh, turn paranoid mode on first of course and backup your databases. -- Richard Huxton Archonet Ltd
Richard, I recall that in earlier versions of the PostgreSQL windows binary distribution, I had finer grained control of what modules were installed. The only optional module is now PL/Java, which I don't use, and things like headers and libraries. I cannot specify installing Pl/PgSQL, Pl/Perl etc, or this fabled debugging module for that matter. This isn't the first time I encountered weirdness with the installer. I recall that when I went to build libpq about 8 months ago, the installer said it installed headers and libraries, which it simply did not. Having gone through the 8.3.1 MSI installer meticulously, it is abundantly clear that this module is unavailable. I uninstalled the last version, 8.3.0, and installed 8.3.1 today. I recall that in the 8.3.0 installer, I could specify that I wanted the module, and I did, but it didn't work, just as the 8.3.1 installer didn't work as described in my original e-mail.That being the case, how should I proceed? Thanks, Peter Geoghegan
>-----Messaggio originale----- >Da: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] Per conto di Peter Geoghegan >Inviato: mercoledì 9 aprile 2008 12.50 >A: Richard Huxton >Cc: pgsql-general@postgresql.org >Oggetto: Re: [GENERAL] Debugging Pl/PgSQL functions with the debug contrib module > >Richard, > >I recall that in earlier versions of the PostgreSQL windows binary >distribution, I had finer grained control of what modules were >installed. The only optional module is now PL/Java, which I don't use, >and things like headers and libraries. I cannot specify installing >Pl/PgSQL, Pl/Perl etc, or this fabled debugging module for that >matter. > >This isn't the first time I encountered weirdness with the installer. >I recall that when I went to build libpq about 8 months ago, the >installer said it installed headers and libraries, which it simply did >not. > >Having gone through the 8.3.1 MSI installer meticulously, it is >abundantly clear that this module is unavailable. I uninstalled the >last version, 8.3.0, and installed 8.3.1 today. I recall that in the >8.3.0 installer, I could specify that I wanted the module, and I did, >but it didn't work, just as the 8.3.1 installer didn't work as >described in my original e-mail.That being the case, how should I >proceed? > >Thanks, >Peter Geoghegan > >-- >Sent via pgsql-general mailing list (pgsql-general@postgresql.org) >To make changes to your subscription: >http://www.postgresql.org/mailpref/pgsql-general I just installed Postgresql 8.3.1 on a fresh machine and in the step 'Enable contrib modules', you can select plDebugger option to enable the debugger. Paolo Saudin
Peter Geoghegan wrote: > Richard, > > I recall that in earlier versions of the PostgreSQL windows binary > distribution, I had finer grained control of what modules were > installed. The only optional module is now PL/Java, which I don't use, > and things like headers and libraries. I cannot specify installing > Pl/PgSQL, Pl/Perl etc, or this fabled debugging module for that > matter. Hmm - I seem to remember there being a fairly long list of optional modules. Perhaps your download didn't unpack correctly? > This isn't the first time I encountered weirdness with the installer. > I recall that when I went to build libpq about 8 months ago, the > installer said it installed headers and libraries, which it simply did > not. That *is* strange, since presumably on Windows it installs them to a sub-folder of the main install. Having said that, I'd say we see more reports of problems with installation on Windows than all other platforms put together. Partly the poor built-in packaging systems and partly the more complex permissions model I suspect. > Having gone through the 8.3.1 MSI installer meticulously, it is > abundantly clear that this module is unavailable. I uninstalled the > last version, 8.3.0, and installed 8.3.1 today. I recall that in the > 8.3.0 installer, I could specify that I wanted the module, and I did, > but it didn't work, just as the 8.3.1 installer didn't work as > described in my original e-mail.That being the case, how should I > proceed? Well, I've just switched into my Windows VM on my laptop here, and I appear to be running pgAdmin 1.8.2 and PostgreSQL 8.3.1, Visual C++ build 1400. It's got 20-odd pldbg_xxx functions installed in my test database and I get the option to debug a plpgsql function if I right-click it. So - at least on XP under vmware it works. The log the installer produced mentions "dbg" and "debug" api .dlls being setup along with adminpack. I've got pgadmin installed and the adminpack. Otherwise, I don't remember doing anything special. What I would do is: 1. Backup and databases 2. Uninstall PG and pgadmin 3. Download a fresh install and check it's good 4. Install from scratch Make sure you keep the logfile the installer generates, that way we can test what's in there. -- Richard Huxton Archonet Ltd
On Wed, Apr 9, 2008 at 12:22 PM, Richard Huxton <dev@archonet.com> wrote: > Peter Geoghegan wrote: > > > Richard, > > > > I recall that in earlier versions of the PostgreSQL windows binary > > distribution, I had finer grained control of what modules were > > installed. The only optional module is now PL/Java, which I don't use, > > and things like headers and libraries. I cannot specify installing > > Pl/PgSQL, Pl/Perl etc, or this fabled debugging module for that > > matter. > > > > Hmm - I seem to remember there being a fairly long list of optional > modules. Perhaps your download didn't unpack correctly? If that list isn't there, then the OP is not using the pgInstaller distro. The contrib modules are all still there on one page, and one of them (on the bottom right if memory serves) is the debugger plugin. Regardless of that, the files should still have been installed, so checkout the README for details of how to setup the debugger in the server: http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/~checkout~/edb-debugger/server/README.pldebugger?rev=1.1 -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com
On 09/04/2008 11:50, Peter Geoghegan wrote: > I recall that in earlier versions of the PostgreSQL windows binary > distribution, I had finer grained control of what modules were > installed. The only optional module is now PL/Java, which I don't use, > and things like headers and libraries. I cannot specify installing > Pl/PgSQL, Pl/Perl etc, or this fabled debugging module for that > matter. Working from memory, the contrib modules aren't listed in the initial tree view of components (which is what you're referring to here) - they're chosen at a later stage in the installation process. Ray. ------------------------------------------------------------------ Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland rod@iol.ie Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals ------------------------------------------------------------------
Paolo, Oh yes, I see it now. It was necessary to re-initialise the database in order for that to appear, which I have not done until now. Now I have a new problem. When I attempt to install postgres 8.3.1 with postgres automatically creating its own user account, the installer complains: "Service 'PostgreSQL Database Server 8.3'(pgsql-8.3) failed to start. Verify that you have sufficient priveleges to start system services." This, despite the fact that 4 postgres.exe processes are now visible in task manager, running as the just created postgres user. I believe that the installer creates accounts with the ability to start services, so this shouldn't be a problem. The account I run PGinstaller is an administrative account. This is a new user account, not one from a previous postgres install. I deleted all the older ones in the well hidden "Local Users and Groups" dialog. What should I do to prevent this messagebox from appearing, which forces me to roll back the installation? Regards, Peter