ALTER USER
  
  SQL - Language Statements
 
 
  
   ALTER USER
  
  
   Modifies user account information
  
 
 
  
   1999-07-20
  
  
ALTER USER username
    [ WITH
     [ SYSID uid ]
     [ PASSWORD password ] ]
    [ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ]
    [ IN GROUP groupname [, ...] ]
    [ VALID UNTIL 'abstime' ]
  
  
   
    1998-09-08
   
   
    Inputs
   
   
    Refer to CREATE USER for a detailed description of each
    clause.
   
   
    
     
       username 
      
       
	The Postgres account name of the user whose details are to be altered.
       
      
     
     
       password 
      
       
	The new password to be used for this account.
       
      
     
     
      uid
      
       
        The new PostgreSQL user id of the user.
        Since this number is used as a key into the
        pg_shadow/pg_user table
        throughout the system catalogs, it is not recommended that you change
        it unless the user in question does not own anything at all and/or
        you really know what you are doing. Note that it is not necessary that
        database and UNIX user ids match, but some people
        choose to keep the numbers the same.
       
      
     
     
       groupname 
      
       
	The name of an access group into which this account is to be put.
       
      
     
     
       abstime 
      
       
	The date (and, optionally, the time)
	at which this user's access is to be terminated.
       
      
     
    
   
  
    
  
   
    1998-09-08
   
   
    Outputs
   
   
    
     
      
ALTER USER
       
      
       
	Message returned if the alteration was successful.
       
      
     
     
     
      
ERROR: alterUser: user "username" does not exist
       
      
       
	Error message returned if the specified user is not known to
	the database.
       
      
     
    
   
  
 
 
  
   1998-09-08
  
  
   Description
  
  
   ALTER USER is used to change the attributes of a user's
   Postgres account.
   Also, it is only possible for the
   Postgres
   user or any user with read and modify permissions on
   pg_shadow to alter user passwords.
  
  
   If any of the clauses of the alter user statement are
   omitted, the corresponding value in the pg_shadow table
   is left unchanged.
  
    
  
   
    1998-09-08
   
   
    Notes
   
   
    ALTER USER
    is a Postgres
    language extension.
   
   
    Refer to CREATE/DROP USER
    to create or remove a user account.
   
   
    The IN GROUP clause is not yet implemented.
   
  
 
 
  
   Usage
  
  
   Change a user password:
  
ALTER USER davide WITH PASSWORD hu8jmn3;
  
   Change a user's valid until date
   
ALTER USER manuel VALID UNTIL 'Jan 31 2030';
   
   Change a user's valid until date, specifying that his
   authorisation should expire at midday on 4th May 1998 using
   the time zone which is one hour ahead of UTC
   
ALTER USER chris VALID UNTIL 'May 4 12:00:00 1998 +1';
   
   Give a user the ability to create other users and new databases.
   
ALTER USER miriam CREATEUSER CREATEDB;
   
   Place a user in two groups
   
ALTER USER miriam IN GROUP sales, payroll;
   
  
 
 
  
   Compatibility
  
    
  
   
    1998-09-08
   
   
    SQL92
   
   
    There is no ALTER USER statement in
    SQL92.
    The standard leaves
    the definition of users to the implementation.