Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql : syntax error at or near "-"

Tags:

postgresql

I am Trying to run a query to update the user password using.

alter user dell-sys with password 'Pass@133'; 

But because of - 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?

like image 386
OpenCurious Avatar asked Sep 06 '13 11:09

OpenCurious


1 Answers

I have reproduced the issue in my system,

postgres=# alter user my-sys with password '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 
like image 180
Atul Arvind Avatar answered Oct 04 '22 06:10

Atul Arvind