Re: Usernames with hyphens

Поиск
Список
Период
Сортировка
От Weilguni Mario
Тема Re: Usernames with hyphens
Дата
Msg-id FA095C015271B64E99B197937712FD020E4B003B@freedom.grz.icomedias.com
обсуждение исходный текст
Ответ на Usernames with hyphens  (Devrim GUNDUZ <devrim@gunduz.org>)
Ответы Re: Usernames with hyphens  (Devrim GUNDUZ <devrim@gunduz.org>)
Список pgsql-hackers
In fakt, it allows users with hyphens, but you have to use quotes:
CREATE USER "foo-bar";
DROP USER "foo-bar";

Regards,Mario Weilguni

-----Ursprüngliche Nachricht-----
Von: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-owner@postgresql.org] Im Auftrag von Devrim GUNDUZ
Gesendet: Montag, 13. Juni 2005 13:31
An: pgsql-hackers@postgresql.org
Betreff: [HACKERS] Usernames with hyphens

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


Hi,

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

template1=# SELECT version();                                                   version
- --------------------------------------------------------------------------------------------------------------
PostgreSQL8.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-----

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Devrim GUNDUZ
Дата:
Сообщение: Usernames with hyphens
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: Usernames with hyphens