SHUTDOWN

Forces a database to shut down, even if there are users connected.

Syntax

SHUTDOWN ( [ 'false' | 'true' ]  )

Parameters

false

[Default] Returns a message if users are connected. Has the same effect as supplying no parameters.

true

Performs a moveout operation and forces the database to shut down, disallowing further connections.

Privileges

Superuser

Notes

Examples

The following command attempts to shut down the database. Because users are connected, the command fails:

=> SELECT SHUTDOWN('false');
NOTICE:  Cannot shut down while users are connected
          SHUTDOWN
-----------------------------
 Shutdown: aborting shutdown
(1 row)

SHUTDOWN() and SHUTDOWN('false') perform the same operation:

=> SELECT SHUTDOWN();
NOTICE:  Cannot shut down while users are connected
          SHUTDOWN
-----------------------------
 Shutdown: aborting shutdown
(1 row)

Using the 'true' parameter forces the database to shut down, even though clients might be connected:

=> SELECT SHUTDOWN('true');          
         SHUTDOWN
----------------------------
 Shutdown: moveout complete
(1 row)

See Also