[Mailman-Developers] user table in Mailman3 with PostgreSQL

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Jul 15 15:25:42 CEST 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/mailman-developers/attachments/20140715/63e7b448/attachment.sig>


More information about the Mailman-Developers mailing list