Home Explore Blog CI



postgresql

1st chunk of `doc/src/sgml/ref/dropuser.sgml`
5955aedb98eee32f81f38e161fe5382dfa142e7ae6006fcc0000000100000fa0
<!--
doc/src/sgml/ref/dropuser.sgml
PostgreSQL documentation
-->

<refentry id="app-dropuser">
 <indexterm zone="app-dropuser">
  <primary>dropuser</primary>
 </indexterm>

 <refmeta>
  <refentrytitle><application>dropuser</application></refentrytitle>
  <manvolnum>1</manvolnum>
  <refmiscinfo>Application</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>dropuser</refname>
  <refpurpose>remove a <productname>PostgreSQL</productname> user account</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
  <cmdsynopsis>
   <command>dropuser</command>
   <arg rep="repeat"><replaceable>connection-option</replaceable></arg>
   <arg rep="repeat"><replaceable>option</replaceable></arg>
   <arg choice="opt"><replaceable>username</replaceable></arg>
  </cmdsynopsis>
 </refsynopsisdiv>


 <refsect1>
  <title>Description</title>

  <para>
   <application>dropuser</application> removes an existing
   <productname>PostgreSQL</productname> user.
   Superusers can use this command to remove any role; otherwise, only
   non-superuser roles can be removed, and only by a user who possesses
   the <literal>CREATEROLE</literal> privilege and has been granted
   <literal>ADMIN OPTION</literal> on the target role.
  </para>

  <para>
   <application>dropuser</application> is a wrapper around the
   <acronym>SQL</acronym> command <link linkend="sql-droprole"><command>DROP ROLE</command></link>.
   There is no effective difference between dropping users via
   this utility and via other methods for accessing the server.
  </para>

 </refsect1>


 <refsect1>
  <title>Options</title>

  <para>
   <application>dropuser</application> accepts the following command-line arguments:

    <variablelist>
     <varlistentry>
      <term><replaceable class="parameter">username</replaceable></term>
      <listitem>
       <para>
        Specifies the name of the <productname>PostgreSQL</productname> user to be removed.
        You will be prompted for a name if none is specified on the command
        line and the <option>-i</option>/<option>--interactive</option> option
        is used.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-e</option></term>
      <term><option>--echo</option></term>
      <listitem>
       <para>
        Echo the commands that <application>dropuser</application> generates
        and sends to the server.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-i</option></term>
      <term><option>--interactive</option></term>
      <listitem>
       <para>
        Prompt for confirmation before actually removing the user, and prompt
        for the user name if none is specified on the command line.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
       <term><option>-V</option></term>
       <term><option>--version</option></term>
       <listitem>
       <para>
       Print the <application>dropuser</application> version and exit.
       </para>
       </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--if-exists</option></term>
      <listitem>
       <para>
        Do not throw an error if the user does not exist. A notice is
        issued in this case.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
       <term><option>-?</option></term>
       <term><option>--help</option></term>
       <listitem>
       <para>
       Show help about <application>dropuser</application> command line
       arguments, and exit.
       </para>
       </listitem>
     </varlistentry>

    </variablelist>
  </para>

  <para>
   <application>dropuser</application> also accepts the following
   command-line arguments for connection parameters:

   <variablelist>
     <varlistentry>
      <term><option>-h <replaceable class="parameter">host</replaceable></option></term>
      <term><option>--host=<replaceable class="parameter">host</replaceable></option></term>
      <listitem>
       <para>
     

Title: dropuser: Remove PostgreSQL User Accounts
Summary
The `dropuser` utility removes a PostgreSQL user account by executing the SQL command `DROP ROLE`. It requires superuser privileges or the `CREATEROLE` privilege with `ADMIN OPTION` on the target role. The utility accepts options for specifying the username, echoing commands, interactive mode, version display, handling non-existent users, and displaying help. It also accepts connection parameters like host.