Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iP4hX-00006b-Ro for pgsql-admin@arkaria.postgresql.org; Mon, 28 Oct 2019 13:04:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iP4hW-0001mC-I6 for pgsql-admin@arkaria.postgresql.org; Mon, 28 Oct 2019 13:04:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iP4hW-0001m5-5L for pgsql-admin@lists.postgresql.org; Mon, 28 Oct 2019 13:04:50 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iP4hP-00027G-2X for pgsql-admin@lists.postgresql.org; Mon, 28 Oct 2019 13:04:48 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 0BBA73E3; Mon, 28 Oct 2019 09:04:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 28 Oct 2019 09:04:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=HaW6nPAlS3ECg3QI9s3yPNFnKQnpugtgxoyVGZiL8 wM=; b=IXlAyUdJQzDGdu3PxTPNagyyXDORCBY5HmRoAgsOVY7AtTE/WSTcDrgAW 8kcfzoX2DW3hMVq6+r40zdu2SClfS0qFKY0aj6Uw62fsOYpOSCM9UoXAzLUJ+xEA KRvsNYzY0TMOf9WY4RpNCISaT0IJ06dc40kOCpN9Lm6j4Gs7Acy6Wk7RXxn1Cld5 kkZp0/Uaw93N3jJy/ATah528nzLCvg/Nlb0kF6/Mtmti9OhXe7UvF7ovDQ5EACHD fHNgGZVzAK3sJYdJQO+vAnERMH2jyL31dww6ER0agF7NUKR8lKnIhXzGkAhBuV+T L8LNkMZlUOhyQW3OQrLSK5KTw8YkQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrleelgdegjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhfhokffffgggjggtgfesthekredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnhguqh hurggurhgrnhhtrdgtohhmqeenucffohhmrghinhepvdhnughquhgrughrrghnthdrtgho mhdprhgvugguihhtrdgtohhmnecukfhppeelfedrvdegvddrudegjedrjeelnecurfgrrh grmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnughquhgr ughrrghnthdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from april.pezone.net (p5df2934f.dip0.t-ipconnect.de [93.242.147.79]) by mail.messagingengine.com (Postfix) with ESMTPA id 3B47380063; Mon, 28 Oct 2019 09:04:39 -0400 (EDT) Subject: Re: the difference between psql , createdb, dropuser To: Jeff Janes , Setve References: Cc: "pgsql-admin@lists.postgresql.org" From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <7b4ed28f-961d-94da-bf28-800011ce8e5d@2ndquadrant.com> Date: Mon, 28 Oct 2019 14:04:38 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-10-28 01:01, Jeff Janes wrote: > On Sun, Oct 27, 2019 at 4:23 PM Setve > wrote: > > I can execute the create user or create db .etc... command at a > PostgreSQL interactive terminal so why are these commands > "createuser , createdb , dropdb etc.... separately and what is their > purpose? > > > > When scripting the initial set up of a system, it is easier to pass the > name to one of these programs, then to embed them into the middle of an > SQL command properly escaped and quoted.  (The names of the programs > themselves are ancient history, if starting from scratch they probably > begin with "pg_") Also, in the distant past, there was no CREATE USER command and the createuser program inserted directly into pg_shadow. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services