Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions internal/dump/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,13 @@ func (f *DumpFormatter) formatObjectCommentHeader(step diff.Diff) string {
// Always use the actual object type for consistency between single-file and multi-file modes
displayType := strings.ToUpper(objectType)

// Special handling for materialized views
if displayType == "VIEW" && step.Source != nil {
if view, ok := step.Source.(*ir.View); ok && view.Materialized {
displayType = "MATERIALIZED VIEW"
}
}

output.WriteString(fmt.Sprintf("-- Name: %s; Type: %s; Schema: %s; Owner: -\n", objectName, displayType, commentSchemaName))
output.WriteString("--\n")
output.WriteString("\n")
Expand Down
2 changes: 1 addition & 1 deletion testdata/dump/bytebase/pgschema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--

-- Dumped from database version PostgreSQL 17.5
-- Dumped by pgschema version 1.0.3
-- Dumped by pgschema version 1.2.1


--
Expand Down
2 changes: 1 addition & 1 deletion testdata/dump/employee/pgschema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--

-- Dumped from database version PostgreSQL 17.5
-- Dumped by pgschema version 1.0.3
-- Dumped by pgschema version 1.2.1


--
Expand Down
2 changes: 1 addition & 1 deletion testdata/dump/sakila/pgschema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ CREATE OR REPLACE VIEW nicer_but_slower_film_list AS
GROUP BY film.film_id, film.title, film.description, category.name, film.rental_rate, film.length, film.rating;

--
-- Name: rental_by_category; Type: VIEW; Schema: -; Owner: -
-- Name: rental_by_category; Type: MATERIALIZED VIEW; Schema: -; Owner: -
--

CREATE MATERIALIZED VIEW IF NOT EXISTS rental_by_category AS
Expand Down
2 changes: 1 addition & 1 deletion testdata/dump/tenant/pgschema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--

-- Dumped from database version PostgreSQL 17.5
-- Dumped by pgschema version 1.0.3
-- Dumped by pgschema version 1.2.1


--
Expand Down