- What are Server Mode and Desktop Mode?
- What should I set the Binary Path configuration option to so I can make and restore backups?
- How do I enable logging in pgAdmin 4?
- How do I start pgAdmin such that it outputs a log to the console?
- Why does pgAdmin seem to use a lot of CPU cycles?
- When pgAdmin runs in desktop mode on my Windows PC, I just see unformatted text on the left of the window. Why?
- On macOS, I get an error like: "pgAdmin 4 is damaged and cannot be opened"
What is pgAdmin 4?
pgAdmin is a management tool for PostgreSQL and derivative relational databases such as EnterpriseDB's EDB Advanced Server. It may be run either as a web or desktop application. For more information on the features offered, please see the Features and Screenshots pages.
Why doesn't pgAdmin use the native File management dialogues?
This is largely for a couple of reasons:
- As pgAdmin is a web application, it can only interact with the local filesystem in ways that are allowed by modern web browsers. This limits what is possible for security; essentially files can only be "downloaded" or "uploaded" (through a form). There is no way to simply save an update to a file by hitting a Save button, nor is it possible to save the working directory for example.
- When running in server mode, files are read from and stored on the server to enable users to work with the same data whatever machine they happen to be using. There are no "native dialogues" for working with files stored on a web server in this way, so we have to implement our own.
We have done extensive evaluation and testing of various ways of managing files in pgAdmin 4, and have consistently found that using our own dialogues provides the best experience (one that we continue to refine and improve with user feedback).
What are Server Mode and Desktop Mode?
When deploying pgAdmin on a web server for multiple users, it is run in server mode (SERVER_MODE = True). This mode requires each user to have an account in pgAdmin, with their own password. Users are required to login to pgAdmin in order to use it. One or more users may be configured as an administrator and will be able to add or remove other users. For more information, please see the Server Deployment and User Management documentation.
To allow running in desktop mode (SERVER_MODE = False), a runtime application is provided to host and display the pgAdmin code (sometimes referred to as the application server). In this mode, each user runs their own instance of pgAdmin, thus no authentication or user management is required. For more information, please see the Desktop Deployment documentation.
What should I set the Binary Path configuration option to so I can make and restore backups?
pgAdmin can utilise PostgreSQL utilities such as pg_dump, pg_restore to enable users to take backups and restore them, as well as run other maintenance operations. The directory path in which these utilities can be found must be provided to pgAdmin to enable these features - see File -> Preferences -> Paths -> Binary paths. You can specify separate paths for the PostgreSQL and EDB Advanced Server binaries. In server mode, the binaries must be installed on the server hosting pgAdmin, whilst in desktop mode they must be on the local machine (that is running pgAdmin).
The binary utilities are typically shipped with the database server packages for your platform. Future versions of pgAdmin may include them in some desktop packages.
How do I enable logging in pgAdmin 4?
The default log settings for pgAdmin will write warnings and errors to a logfile, the location of which depends on the platform:
- Linux/MacOS: ~/.pgadmin/pgadmin4.log
- Windows: %APPDATA%\pgAdmin\pgadmin4.log
To override the log settings, create a file called config_local.py in the web/ directory of the installation, alongside the existing config.py. This file can be used to override any of the settings in config.py (which shouldn't be edited). To modify the logging settings, create a file similar to the following:
import logging # Application log level - one of: # CRITICAL 50 # ERROR 40 # WARNING 30 # SQL 25 # INFO 20 # DEBUG 10 # NOTSET 0 CONSOLE_LOG_LEVEL = logging.DEBUG FILE_LOG_LEVEL = logging.DEBUG # Log format. CONSOLE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s' FILE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s' # Log file name LOG_FILE = '/desired/path/to/pgadmin4.log'
Once the configuration change has been made, pgAdmin must be restarted.
How do I start pgAdmin such that it outputs a log to the console?
If you're running in server mode, or directly using Python, then console logs will be sent directly to the tty under which the application is started.
In desktop mode, the process varies depending on the platform:
- Linux: Start the desktop runtime from the command line, e.g. /usr/local/pgadmin4/bin/pgadmin4, adjusting the path as necessary.
- MacOS: Start the desktop runtime from the command line, e.g. /Applications/pgAdmin\ 4.app/Contents/MacOS/pgAdmin4, adjusting the path as necessary.
- Windows: It is not possible to output console logs on Windows.
Why does pgAdmin seem to use a lot of CPU cycles?
pgAdmin 4's architecture will naturally require more CPU and memory than a traditional native desktop application, however, pgAdmin 4 also includes continually updating dashboards that weren't present in pgAdmin III. The dashboards update each graph every second by default, even if they are not visible (to avoid gaps in the data). CPU usage may be noticably reduced by adjusting the refresh speed of the graphs to a longer period, such as ten seconds. This can be done under File -> Preferences -> Paths -> Dashboards -> Graphs. After changes have been made, you may need to navigate to a different dashboard instance for the changes to take effect.
When pgAdmin runs in desktop mode on my Windows PC, I just see unformatted text on the left of the window. Why?
This behaviour has been observed by a number of users on Windows. Essentially what is happening is that the browser is ignoring the stylesheets that properly format the display. In all cases seen, this was because a registry setting on the machine had been set to an incorrect value, possibly by the installation of a particular editor. To resolve the issue, use the Windows Registry Editor to reset the value of "HKEY_CLASSES_ROOT\.css\Content Type" to "text/css" (without the quotes), and then restart pgAdmin.
On macOS, I get an error like: "pgAdmin 4 is damaged and cannot be opened"
This has been seen mostly on older versions of macOS (e.g. 10.10). Unfortunately the error message is usually misleading, and the digital signature of the application will validate correctly. The actual problem is typically that the operating system is configured to only allow running of app from the Apple App store.
To change this setting, open the Preferences Panel and then browse to Security and Privacy. From there, change the Allow apps downloaded from setting to App Store and identified developers (more secure) or Anywhere (less secure).
Note that the available options and their labels vary from release to release of macOS, and may not be exactly as described above.