Thanks for the trick with the double quotes to escape reserved keywords.

Actually I wanted to display the content of the user table to find out in which 
table are the subscribers of any mailing list recorded. Do you have any idea? 




On Tuesday, July 15, 2014 3:25 PM, Daniel Kahn Gillmor <[email protected]> 
wrote:
On 07/15/2014 06:16 AM, ML mail wrote:
> Hello,
> 
> I am not sure it is a good idea to name the user table "user". As you can see 
> in PostgreSQL "user" is a reserved word:
> 
> \c mailman
> 
> select * from user;
>  current_user
> --------------
>  postgres
> 
> (1 row)
> 
> Any ideas how I can still list the content of the mailman3 user table in 
> PostgreSQL?

You should wrap the name of the table in double quotation marks:

dkg=> create table "user" ( foo int );
CREATE TABLE
dkg=> insert into "user" (foo) VALUES (1);
INSERT 0 1
dkg=> select * from "user";
foo



-----
   1
(1 row)

dkg=>

This is generally good practice for all table names, if you want to
treat them consistently in your code.

hth,

    --dkg

_______________________________________________
Mailman-Developers mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to