Open hiendaovinh opened 1 year ago
It would be a reasonable expectation, I just haven't gotten to it yet.
Because materialized views are not part of the SQL specification, Postgres does not include information about them in the information_schema.views
table.
So querying for details of a materialized view needs a whole new query in the driver.
I'm not sure how soon I'll get to this myself. Of course, I'll be happy to review a PR for this 😁.
I'll be happy to work on this. Let me test pg_get_viewdef
and pg_matviews
and see what I can do.
pg_attribute
holds enough information on matview columns. We just need to find a way to map & normalize them to information_schema.
If you can implement this TableDetails
function for materialized views, then the rest would be a breeze.
Yes I'm working on it.
pg_attribute & information_schema.columns
Will comeback and update this.
This might also helps: https://github.com/typeorm/typeorm/blob/master/src/driver/postgres/PostgresQueryRunner.ts
Another place to look is in SQLBoiler. https://github.com/volatiletech/sqlboiler/blob/master/drivers/sqlboiler-psql/driver/psql.go#LL392C2-L485
While not expecting exactly the same columns, it is quite similar since Bob was heavily inspired by SQLBoiler.
How's it going? @hiendaovinh
Sorry, there's no further progress yet because I was kind of busy last week. Will come back this week sir.
Hi, With the given schema: https://github.com/stephenafamo/bob/blob/main/gen/bobgen-psql/driver/testdatabase.sql, I think it's reasonable to expect bob to generate
type_monsters_mv
columns just liketype_monsters_v
but it doesn't. Is it expected behavior? https://github.com/stephenafamo/bob/blob/main/gen/bobgen-psql/driver/psql.golden.json#L2228-L2238 Thank you.