15 Jul
2014
15 Jul
'14
8:25 a.m.
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