-
-
Notifications
You must be signed in to change notification settings - Fork 297
feat(pg): Add support for Postgres materialized views (relkind = 'm') and test #2279
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
base: main
Are you sure you want to change the base?
feat(pg): Add support for Postgres materialized views (relkind = 'm') and test #2279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for PostgreSQL materialized views in Martin tile server by treating them as discoverable objects alongside regular tables and views. The change enables materialized views to be included in server listings and accessible via the API.
Key Changes:
- Modified SQL query to include materialized views (relkind = 'm') in database object discovery
- Added test fixtures and validation for materialized view functionality
- Expanded test coverage for cross-schema object handling
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
martin/src/config/file/postgres/resolver/scripts/query_available_tables.sql |
Updated WHERE clause to include materialized views in database object queries |
tests/fixtures/tables/materialized_view.sql |
Added test fixture with materialized view creation and sample data |
tests/test.sh |
Added test cases for materialized view JSON and PBF response validation |
for more information, see https://pre-commit.ci
CommanderStorm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two requests:
Please run just bless to bless the tests snapshots.
Below, there is is_view. It is used to give debug information like here:
https://github.com/maplibre/martin/blob/c16ceabed73ff66fe8d55452341fe01b5f64681f/martin/src/config/file/postgres/builder.rs#L500C4-L500C11
Let's change this to relkind and give more accurate error messages in the usages.
I have run do you want me to change it to an |
|
Yes |
|
I have added the Some trait bounds are not satisfied |
72fe68c to
729108e
Compare
for more information, see https://pre-commit.ci
CommanderStorm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the Option but it breaks the code.
Some trait bounds are not satisfied
I changed this to i8 as Char gets translated this way.
I have not investigated all testcase fails, the code might not be entirely sound.
martin/src/config/file/tiles/postgres/resolver/scripts/query_available_tables.sql
Outdated
Show resolved
Hide resolved
…vailable_tables.sql
Signed-off-by: Kunal Singh Dadhwal <[email protected]>
|
Kindly review @CommanderStorm |
nyurik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work! one minor thing, and i think ok to merge, but I will let @CommanderStorm drive this. Thanks!
| SELECT id, txt, geom | ||
| FROM fixtures_comments; | ||
|
|
||
| COMMENT ON MATERIALIZED VIEW fixtures_mv_comments IS 'fixture: materialized view comments'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should make this into a proper json comment, just like other SQL, rather than ignoring this warning below
| remove_lines "$LOG_FILE" 'PostgreSQL 11.10.0 is older than the recommended minimum 12.0.0' | ||
| remove_lines "$LOG_FILE" 'In the used version, some geometry may be hidden on some zoom levels.' | ||
| remove_lines "$LOG_FILE" 'Unable to deserialize SQL comment on public.points2 as tilejson, the automatically generated tilejson would be used: expected value at line 1 column 1' | ||
| remove_lines "$LOG_FILE" 'Unable to deserialize SQL comment on public.fixtures_mv_comments as tilejson, the automatically generated tilejson would be used: expected value at line 1 column 1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be ignored i think
for more information, see https://pre-commit.ci
Fixes #2267
New Features
Tests