Search Postgresql Archives

Re: initdb createuser commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Samuel Williams wrote:

> John - that's an interesting example. If it's that easy, why isn't
> that the approach given in tutorials and other documentation? What was
> the motivation for the createuser command?

initdb, createdb and createuser existed even before Postgres
adopted SQL, back when it was developed by the University of
Berkeley.

You can find references to these commands in the doc here:
http://db.cs.berkeley.edu/postgres-v4r2/postgres-setup.ps
which dates back from 1994.
(fun fact: there was no psql yet, the equivalent command was called
"monitor". How about that for a name that has seemingly nothing
to do with postgres? :)

According to these old instructions, commands are installed
by default into /usr/local/postgres/bin,
so that was their namespace. They were not supposed to be mixed
with other non-postgres commands.

That's still the case today if you run ./configure and
"make install" from the current postgresql sources:
these commands end up in /usr/local/pgsql/bin
Some installers such as the EDB installers for Windows or Unix
typically use a dedicated directory for PostgreSQL, so again its
commands don't get mixed with other stuff.

As for the Postgresql pre-compiled packages that come with Linux
distributions, they need to respect the policy of their distros,
meaning that all user-callable commands should be in the default $PATH.
That implies that, for instance, postgresql's "createuser" ends up
in $PATH along with the system's "adduser", even though they have
hardly anything to do with each other, so yes, that's somehow
unfortunate.
But these decisions are made by packagers and distributions, not
by the PostgreSQL developers.

Some of these commands are already documented as deprecated,
for example "createlang", which I find in Ubuntu 14.04 /usr/bin:
$ man createlang
	  [...]
	  Caution
	   createlang is deprecated and may be removed in a future PostgreSQL
	   release. Direct use of the CREATE EXTENSION command is recommended
	   instead.

The same could theorically be done to createuser/dropuser or
createdb/dropdb, but there's the question of whether this would create
more harm that good, because they're much widely used in
existing scripts and tutorials.

Note that in any case your proposal to use "pg" as an
umbrella-command wouldn't fly with these systems because pg is a
pager from the Debian's util-linux package.

$ which pg
/usr/bin/pg

$ man pg
PG(1)				 User Commands				
PG(1)

NAME
       pg - browse pagewise through text files

SYNOPSIS
       pg [-number] [-p string] [-cefnrs] [+line] [+/pattern/] [file...]
...

Also, the same Debian/Ubuntu systems don't have initdb or pg_ctl
in the default $PATH, as these commands are superseded
by different distro-specific pg_* commands . This is also
something that should be considered if thinking of unifying
the binaries.


Best regards,
-- 
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux