Обсуждение: Username with a hyphen character (grant failing?)
What's the scoop with username constraints? I setup and created a user with a '-' character in the middle (worked). When I tried to grant the new user some privs, grant choked on the '-' w/ a parse error. foo=# GRANT SELECT ON test TO www-foo; ERROR: parser: parse error at or near "-" foo=# update pg_shadow set usename = 'www_foo' where usename = 'www-foo'; UPDATE 1 foo=# GRANT SELECT ON maildir TO www_foo; CHANGE Did I miss a page someplace that said I couldn't use a '-' in a username, or is this a bug? -sc -- Sean Chittenden
Вложения
Sean Chittenden <sean-pgsql-general@chittenden.org> writes: > What's the scoop with username constraints? I setup and > created a user with a '-' character in the middle (worked). Double quotes are your friend when dealing with names that don't follow the usual constraints for identifiers. regards, tom lane
> > What's the scoop with username constraints? I setup and > > created a user with a '-' character in the middle (worked). > > Double quotes are your friend when dealing with names that don't > follow the usual constraints for identifiers. Are single quotes treated differently than double? I tried single, but didn't have any luck... -sc -- Sean Chittenden
Вложения
Sean Chittenden <sean-pgsql-general@chittenden.org> writes: > > > What's the scoop with username constraints? I setup and > > > created a user with a '-' character in the middle (worked). > > > > Double quotes are your friend when dealing with names that don't > > follow the usual constraints for identifiers. > > Are single quotes treated differently than double? I tried > single, but didn't have any luck... -sc Yes. Single quotes are for strings; double quotes are for identifiers. -Doug -- The rain man gave me two cures; he said jump right in, The first was Texas medicine--the second was just railroad gin, And like a fool I mixed them, and it strangled up my mind, Now people just get uglier, and I got no sense of time... --Dylan
On Fri, May 25, 2001 at 11:38:50AM -0400, Doug McNaught wrote: > Sean Chittenden <sean-pgsql-general@chittenden.org> writes: > > > > > What's the scoop with username constraints? I setup and > > > > created a user with a '-' character in the middle (worked). > > > > > > Double quotes are your friend when dealing with names that don't > > > follow the usual constraints for identifiers. > > > > Are single quotes treated differently than double? I tried > > single, but didn't have any luck... -sc > > Yes. Single quotes are for strings; double quotes are for > identifiers. meaning, for example: create table info ( "this field" text, "that-field" integer, "it's alarming" serial ); insert into info("this-field")values('here\'s the contents for that column in the table'); or grant select on "table named with spaces" to "some-oddball-user"; select 'this is a string value, not a field or table name'; -- #95: We are waking up and linking to each other. We are watching. But we are not waiting. -- www.cluetrain.com will@serensoft.com http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!