Select Wat from SQL
scattered-thoughts.netIs this one real?
jamie=# create table users ("user" text, "password" text);
CREATE TABLE
jamie=# insert into users values ('bob', 'whatever');
INSERT 0 1
jamie=# select user, password from users;
user | password
-------+----------
jamie | whatever
(1 row)Yes, user is a reserved word and `SELECT user` gives you the current database user. Notice how in the create table "user" is quoted, because it would be a syntax error otherwise. If you quote the same way in the select it will give you the user column, not the user reserved word:
select "user", password from users;