Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty schema! error with postgresql #68

Closed
emekanw opened this issue Aug 18, 2014 · 6 comments
Closed

Empty schema! error with postgresql #68

emekanw opened this issue Aug 18, 2014 · 6 comments

Comments

@emekanw
Copy link

emekanw commented Aug 18, 2014

I have a public schema but keep getting this error when trying to run the admin.

@emekanw emekanw changed the title Empty schema! error with postresql Empty schema! error with postgresql Aug 18, 2014
@simov
Copy link
Owner

simov commented Aug 18, 2014

You need some tables in your database. Exress Admin can't create tables for you, it can only edit existing ones.

@emekanw
Copy link
Author

emekanw commented Aug 18, 2014

I have a table, I even used the express-admin-example but got the same error. For some reason
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' works on pgadmin and returns the tables but returns an empty array with

var sql = query.replace('show-tables', schema);.

this.client.query(sql, function (err, rows) {
console.log(rows);
if (err) return cb(err);
if (rows.length) return cb(null, false);
cb(null, true);
}

in https://github.com/simov/express-admin/blob/master/lib/db/database.js

@simov
Copy link
Owner

simov commented Aug 18, 2014

This error message might not be correct. Can you check out if the database user you are connecting with have granted permissions for this schema, tables and sequences you are using.

Example for granting permissions to your user here - https://github.com/simov/express-admin-examples/#postgresql

@emekanw
Copy link
Author

emekanw commented Aug 18, 2014

yes I did that, my user has permission.

@simov
Copy link
Owner

simov commented Aug 18, 2014

That's very strange, the only problem I can think of is misconfiguration or missing privileges (the error message isn't correct, which is silly)

Here is what I normally do

# import
sudo -u postgres psql 'db' < dump.sql
# cmd
sudo -u postgres psql
\c "to-the-database-first!"
grant all on database "express-admin-examples" to liolio;
grant all on schema "public" to liolio;
grant all on all tables in schema "public" to liolio;
grant all on all sequences in schema "public" to liolio;

-- additionally you may need to change the owner of each table and sequence
alter table [tableName] owner to liolio;
alter sequence [sequenceName] owner to liolio;

@emekanw
Copy link
Author

emekanw commented Aug 19, 2014

That helped thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants