Error Syntax Error At Or Near Createuser
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn syntax error at or near postgres more about Stack Overflow the company Business Learn more about hiring developers or posting create superuser postgres ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community postgres create user example Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Got error while creating database in postgres up vote 0
Create User Postgres
down vote favorite I want to create user and database in linux server. I am able to create user with the following code: su - postgres # createuser -S -D -R myUser but when I tried to create database with code : # createdb -U myUser -p 5432 myDatabase I get following error: createdb: could not connect to database postgres: FATAL: Ident authentication failed for user "myUser" I postgres show users am new to linux so I am unable to figure out why I was able to create user but while creating database there is connection error with postgres. And also error for ident authentication for user. linux postgresql share|improve this question asked May 12 '11 at 8:32 Rohita Khatiwada 72851943 I think this question might be better suited on serverfault or superuser or unix.stackexchange. Probably you will get better answers there. The question has not much to do with programming (what stackoverflow is intended for). –bmk May 12 '11 at 8:40 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted I am new to linux so I am unable to figure out why I was able to create user but while creating database there is connection error with postgres. And also error for ident authentication for user. ident is an authentication schema that relies on the currently logged in user. If you've su -s to postgres and then try to login as another user, ident will fail (as it's not the currently logged in user). You can solve this issue in two ways, I tend to use the latter. solution: simply make sure the
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting psql create table ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Psql Commands
the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a
Postgres Change User Password
minute: Sign up Postgresql : syntax error at or near “-” up vote 3 down vote favorite 1 I am Trying to run a query to update the user password using. alter user dell-sys with password 'Pass@133'; But because of - http://stackoverflow.com/questions/5975369/got-error-while-creating-database-in-postgres it's giving me error like, ERROR: syntax error at or near "-" LINE 1: alter user dell-sys with password 'Pass@133'; ^ Can Anyone shade a light on it? postgresql share|improve this question edited yesterday a_horse_with_no_name 186k24234311 asked Sep 6 '13 at 11:18 OpenCurious 5432618 postgresql.org/docs/current/static/… –a_horse_with_no_name Sep 6 '13 at 11:35 add a comment| 2 Answers 2 active oldest votes up vote 10 down vote accepted I have Regenerated the issue in my system, postgres=# alter user my-sys with password http://stackoverflow.com/questions/18656545/postgresql-syntax-error-at-or-near 'pass11'; ERROR: syntax error at or near "-" LINE 1: alter user my-sys with password 'pass11'; ^ Here is the issue, psql is asking for input and you have given again the alter query see postgres-#That's why it's giving error at alter postgres-# alter user "my-sys" with password 'pass11'; ERROR: syntax error at or near "alter" LINE 2: alter user "my-sys" with password 'pass11'; ^ Solution is as simple as the error, postgres=# alter user "my-sys" with password 'pass11'; ALTER ROLE share|improve this answer answered Sep 6 '13 at 12:24 Atul Arvind 6,58042544 yes it is, I have not recognize it, Thanks a for the effort. –OpenCurious Sep 6 '13 at 12:27 add a comment| up vote 5 down vote Wrap it in double quotes alter user "dell-sys" with password 'Pass@133'; Notice that you will have to use the same case you used when you created the user using double quotes. Say you created "Dell-Sys" then you will have to issue exact the same whenever you refer to that user. I think the best you do is to drop that user and recreate without illegal identifier characters and without double quotes so you can later refer to it in any case you want. share|improve this answer edited Sep 6 '13 at 11:24 answered Sep 6 '13 at 11:19 Clodoaldo Neto 47.8k869117 Tried this one, it's giving ERROR: syntax error at or near "alter" LINE 2: alter user "dell-sys" with password 'Pass@133
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss http://stackoverflow.com/questions/17266784/syntax-error-at-or-near-user-when-adding-postgres-constraint the workings and policies of this site About Us Learn more about https://bugs.debian.org/224716 Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each syntax error other. Join them; it only takes a minute: Sign up Syntax error at or near “user” when adding Postgres constraint up vote 3 down vote favorite I'm running Postgres 8.4.13, and trying to add a constraint to an existing table. According to the docs, this should be possible: alter table indexed_friends add constraint no_duplicate_user_friends unique (user, friend); Yet when syntax error at I run this I get the following error: ERROR: syntax error at or near "user" I'm confused because I'm following an unique constraint example listed in the documentation almost exactly. I can provide the table schema, but since it's complaining about a syntax error, I'm not sure that's necessary. postgresql share|improve this question edited Jul 20 '13 at 20:11 asked Jun 24 '13 at 1:02 Kevin Burke 11.8k2486186 add a comment| 1 Answer 1 active oldest votes up vote 6 down vote accepted Ahhh... The word user is a reserved word in Postgres. Surrounding it in quotes: alter table indexed_friends add constraint no_duplicate_user_friends unique ("user", friend); worked. share|improve this answer answered Jun 24 '13 at 1:03 Kevin Burke 11.8k2486186 1 Better still, don't use reserved words as column names. It's just a continuing series of sorrow and problems like this. –Andy Lester Jun 24 '13 at 3:41 Yeah... sadly I did the initial schema in SqlAlchemy, so I didn't even realize the problem. –Kevin Burke Jun 24 '13 at 4:
src:postgresql-common. Reported by: simon raven