Usernames with hyphens

From: Devrim GUNDUZ <devrim(at)gunduz(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Usernames with hyphens
Date: 2005-06-13 11:30:36
Message-ID: Pine.LNX.4.63.0506131421400.22564@emo.org.tr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

AFAIK, PostgreSQL does not allow hyphens in usernames and databases,
right?

template1=# SELECT version();
version
- --------------------------------------------------------------------------------------------------------------
PostgreSQL 8.0.3 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC)
3.2.3 20030502 (Red Hat Linux 3.2.3-42)
(1 row)

template1=# CREATE DATABASE hyphen-test;
ERROR: syntax error at or near "-" at character 22
LINE 1: CREATE DATABASE hyphen-test;
^
This is the same for users;

template1=# CREATE USER hyphen-test;
ERROR: syntax error at or near "-" at character 18
LINE 1: CREATE USER hyphen-test;
^
However, createuser allows us to create users that include a hyphen:

# createuser hyphen-test -U postgres
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
Password:
CREATE USER

but it is not allowed in CREATE DATABASE syntax:

template1=# CREATE DATABASE hyphen_test with owner hyphen-test;
ERROR: syntax error at or near "-" at character 46
LINE 1: CREATE DATABASE hyphen_test with owner hyphen-test;

template1=# SELECT * from pg_shadow WHERE usename='hyphen-test';
usename | usesysid | usecreatedb | usesuper | usecatupd | passwd |
valuntil | useconfig
- -------------+----------+-------------+----------+-----------+--------+----------+-----------
hyphen-test | 103 | f | f | f | |
|
(1 row)

Is it a bug in createuser or am I missing a point? Same applies to
createdb:

# createdb hyphen-test -U postgres
Password:
CREATE DATABASE

Regards,

- --
Devrim GUNDUZ
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.tdmsoft.com.tr http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFCrW5dtl86P3SPfQ4RAuF5AJ4xGGqswtNdzcLGi/lNCo8hD5PsYgCggllm
u5GYDj/JODlZ5HA+XYD79DM=
=pFsg
-----END PGP SIGNATURE-----

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Weilguni Mario 2005-06-13 11:34:03 Re: Usernames with hyphens
Previous Message Marc G. Fournier 2005-06-13 06:12:59 Re: The Contrib Roundup (long)