GRANT
ing ALL
permissions for public to the database is mostly redundant (as public has connect, temporary by default, so you'd only be adding CREATE
which you probably don't want to do). You probably expected a GRANT ALL
on the database to result in a recursive GRANT ALL
to contained schemas and tables. GRANT
is not recursive, so this doesn't happen; a GRANT ALL
on a database just grants CONNECT
and TEMPORARY
rights to the database, with no effect on contained schemas and tables.
The default GRANT
s are, from the docs on GRANT:
PostgreSQL grants default privileges on some types of objects to
PUBLIC. No privileges are granted to PUBLIC by default on tables,
columns, schemas or tablespaces. For other types, the default
privileges granted to PUBLIC are as follows: CONNECT and CREATE TEMP
TABLE for databases; EXECUTE privilege for functions; and USAGE
privilege for languages. The object owner can, of course, REVOKE both
default and expressly granted privileges. (For maximum security, issue
the REVOKE in the same transaction that creates the object; then there
is no window in which another user can use the object.) Also, these
initial default privilege settings can be changed using the ALTER
DEFAULT PRIVILEGES command.
So you can see you don't need to GRANT
anything on the database unless you want the user to be able to create schemas, etc. You need to:
GRANT USAGE ON SCHEMA myschema TO theuser;
for any schema other than public
. CREATE
can be granted if you want the user to be able to make tables, views, etc.
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE sometable TO theuser;
for tables. I've omitted the TRUNATE
, REFERENCES
and TRIGGER
rights as you probably don't want to grant them.
GRANT USAGE ON SEQUENCE sometable_somecolumn_seq TO theuser;
for any sequences that are used in table defaults, either explicitly or via a SERIAL
or BIGSERIAL
column.
... etc. See the manual for GRANT
linked above for full definitions of what the privileges do, which are available on which objects, etc. Take note of the wildcard ALL TABLES
and ALL SEQUENCES
options.
If this seems like too much hassle to do for each table, view, schema, sequence, etc, you can in Pg 9.1 and above use ALTER DEFAULT PRIVILEGES
to change the default GRANT
s on new objects.
Can you log into your games database using psql?
What I can see is that the first image has you connecting to localhost:5432, the second (the psql connection), you're connecting to jkalancic@vps73162 - on what appears to be a telnet session - are you sure that you're looking at the same database on the same machine?
[Following OP's answer]
A tip for next time - you could install from source and not be messing with /etc/postgresql - you can never be absolutely sure that you're not mixing clients, servers and ports unless you do this. I do this all the time for installs - on Linux and I see that you're on Ubuntu, so that should be a piece of cake.
PostgreSQL is really excellent for this kind of thing. Works first time straight - and you can tailor your prompt to point to your various installs - be sure to have a shutdown (in your startup script) if you want to put more than one server on port 5432.
Best Answer
The lack of access to temporary tables in other sessions is not a matter of permissions, it's a technical limitation of the design. A PostgreSQL backend can't access temporary tables of another backend because none of the usual housekeeping to allow concurrent access is done for temporary tables.
In 9.2 you will want to use an
UNLOGGED
table instead; this can be visible from other sessions, but retains most of the performance benefits of a temporary table.