[Mailman-Developers] user table in Mailman3 with PostgreSQL
ML mail
mlnospam at yahoo.com
Wed Jul 16 16:34:36 CEST 2014
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 <dkg at fifthhorseman.net> 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
More information about the Mailman-Developers
mailing list