Re: Single quotes vs. double quotes when setting a pwd and other cmds

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Single quotes vs. double quotes when setting a pwd and other cmds
Date: 2010-06-23 09:10:24
Message-ID: 4C21CF80.7000501@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le 23/06/2010 11:03, Alexander Farber a écrit :
> Hello,
>
> why aren't double quotes accepted below?
>
> db1=# alter user user1 password "pass1";
> ERROR: syntax error at or near ""pass1""
> LINE 1: alter user user1 password "pass1";
> ^
> db1=# alter user user1 password 'pass1';
> ALTER ROLE
>
> Is there a thumb rule to know when to use which quotes?
> I'm often confused by them when using psql.
>

Use double quotes for identifiers, and single quotes for string values.

The password is a string, so you use single quotes with it. The username
is an identifier, so you (can) use double quotes with it.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2010-06-23 09:11:21 Re: Single quotes vs. double quotes when setting a pwd and other cmds
Previous Message Alexander Farber 2010-06-23 09:03:04 Single quotes vs. double quotes when setting a pwd and other cmds