Skip to content

custom schema name is not honored #48

@aol-nnov

Description

@aol-nnov

Hi!

I was trying to use express-admin with postgresql database.
My tables are placed in a schema with custom name.
After creating initial configuration I saw all my tables from custom schema at http://localhost:3000/ but if I click on any table name or on the plus sign, it spits a small stack trace

error: relation "vendor" does not exist
    at Connection.parseE (/home/aol/develop/web/express-admin/node_modules/express-admin/node_modules/pg/lib/connection.js:558:11)
    at Connection.parseMessage (/home/aol/develop/web/express-admin/node_modules/express-admin/node_modules/pg/lib/connection.js:387:17)
    at null.<anonymous> (/home/aol/develop/web/express-admin/node_modules/express-admin/node_modules/pg/lib/connection.js:92:20)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:746:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)
GET /vendor/add 500 5ms - 820b

After some digging I've managed to enable sql queries logging and found out that schema name is not present in the query:
SELECT "vendor"."id" AS __pk,"vendor"."name","vendor"."id" FROM "vendor" WHERE "id"=null ;

As a quick test I've hacked into utils/query.js and hardcoded schema name into queries, which proved the root cause of the issue - the aforementioned error disappeared.

Unfortunately, I do not have much free time now to wrap my head around the express-admin sources to contribute a fix, but I'd be glad if this issue would be resolved soon.

Thanks in advance,
Andrey

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions