Why is that the following simple query does not work (Using Django in the backend)
# select group.name from auth_group as group;
ERROR: syntax error at or near "."
LINE 1: select group.name from auth_group as group;
while the following works
# select groupd.name from auth_group as groupd;
name
---------------
FO Admin Role
admin
alice
bob
(4 rows)
What is wrong with using group
as an alias ?
CodePudding user response:
group
is a reserved keyword (group by
) and thus can't be used as a regular identifier.
You could use it by enclosing it in double quotes as "group"
but I strongly recommend to use some other name.