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

Problem perhaps related to limited access rights when reading metadata #6

Closed
jarlestabell opened this issue May 16, 2017 · 1 comment

Comments

@jarlestabell
Copy link

jarlestabell commented May 16, 2017

Hi,
When using pogi with a postgres user which has rather limited access rights, I get a problem in pgDb.ts, in the initFieldTypes() function.
The error I get is "Cannot read property 'fieldTypes' of undefined".

If I change this:

...
for (let r of specialTypeFields.rows) {
            this.schemas[r.schema_name][r.table_name].fieldTypes[r.column_name] =
                ([3802, 114].indexOf(r.typid) > -1) ? FieldType.JSON :
                    ([3614].indexOf(r.typid) > -1) ? FieldType.TSVECTOR :
                    ([1082, 1083, 1114, 1184, 1266].indexOf(r.typid) > -1) ? FieldType.TIME :
                        FieldType.ARRAY;
...

into something like:

...
for (let r of specialTypeFields.rows) {
   if(this.schemas[r.schema_name][r.table_name]) { 
            this.schemas[r.schema_name][r.table_name].fieldTypes[r.column_name] =
                ([3802, 114].indexOf(r.typid) > -1) ? FieldType.JSON :
                    ([3614].indexOf(r.typid) > -1) ? FieldType.TSVECTOR :
                    ([1082, 1083, 1114, 1184, 1266].indexOf(r.typid) > -1) ? FieldType.TIME :
                        FieldType.ARRAY;
   }
...

ie inserting an if test to check if we actually have the table metadata, pogi seems to work ok also in my case with limited postgres privileges.

@holdfenytolvaj
Copy link
Owner

Thanks for the report!

And sorry for the delay, in the meantime I've joined to a big co, and wasn't sure whether I can work on this project. But apparently yes. Just added the fix and published it!
Thanks again!

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