Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6B9121337BF5 for ; Wed, 4 May 2011 13:06:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 74172-05 for ; Wed, 4 May 2011 16:06:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f174.google.com (mail-iw0-f174.google.com [209.85.214.174]) by mail.postgresql.org (Postfix) with ESMTP id B021D1337BFD for ; Wed, 4 May 2011 13:05:39 -0300 (ADT) Received: by iwn34 with SMTP id 34so1071260iwn.19 for ; Wed, 04 May 2011 09:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=NsjOIwKAujVmKGysHgQNTIGW4NFyGzWw+QoeH3+gER4=; b=OGfdn3qz3HtvGD0KGlQ/bVY9kL1c6meCDFpYv26jVmBPkPMaD60s/MPDcIPM1n+BLB tDyoFJ0PDi0krWoHAK3rVxUCkZi1Vmm1dv6YWZ94xSZ+g0TcuVMM03bR6RdB2IjUkJzU 3Pv5mB/GjE9NIFCZqruPDDE/+H4Qb2ORIzjcY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=UoSOVM0OhkG1hWJf1cT2+cCSRTTle2A2P3ix7ICRsYzXwHG8BuVrcNNJsmTW2g0s0w UaHrJeeogBj6/R4Udsh8o9+AS4REzRDeuZSjm0rinMDVyytZ5BYkPBe8t5AEHt3LEFzs Iy7naCvabDUZskOhl1NLk8G4pr/BWuew9iF9k= MIME-Version: 1.0 Received: by 10.231.4.139 with SMTP id 11mr356259ibr.65.1304525139228; Wed, 04 May 2011 09:05:39 -0700 (PDT) Received: by 10.231.37.2 with HTTP; Wed, 4 May 2011 09:05:39 -0700 (PDT) Date: Wed, 4 May 2011 18:05:39 +0200 Message-ID: Subject: createuser/dropuser username From: Grzegorz Szpetkowski To: pgsql-docs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.888 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201105/7 X-Sequence-Number: 6682 Hi, I think that createuser/drouser reference documentation could be enhanced for username param. There is: "createuser is a wrapper around the SQL command CREATE ROLE. There is no effective difference between creating users via this utility and via other methods for accessing the server." http://www.postgresql.org/docs/9.0/static/app-createuser.html http://www.postgresql.org/docs/9.0/static/app-dropuser.html But createuser and dropuser wrappers in some cases are doing implicit quoting (when CREATE ROLE is not), which I think is not fully known and is undocumented here. For example: createuser -SDRe user -- reserved in PostgreSQL CREATE ROLE "user" NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN; createuser -SDRe myuser CREATE ROLE myuser NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN; createuser -SDRe MYuser CREATE ROLE "MYuser" NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN; psql postgres ALTER ROLE MYuser CREATEDB; -- fatal mistake, it works for myuser delimited identifier ALTER ROLE ALTER ROLE "MYuser" CREATEDB; -- ok, quoted identifier ALTER ROLE ALTER ROLE user CREATEDB; ERROR: syntax error at or near "user" LINE 1: ALTER ROLE user CREATEDB; ^ postgres=# ALTER ROLE "user" CREATEDB; ALTER ROLE Regards, Grzegorz Szpetkowski