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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ edition = "2024"
pgdog-plugin = { path = "./pgdog-plugin", version = "0.4.0", default-features = false }
pgdog-config = { path = "./pgdog-config", version = "0.1.0" }
pgdog-postgres-types = { path = "./pgdog-postgres-types"}
pg_raw_parse = { git = "https://github.com/pgdogdev/pg_raw_parse.git", rev = "6a6e16719b48eae2c5897e2e28de8d2bd65184f9" }
# TODO: update after merge https://github.com/pgdogdev/pg_raw_parse/pull/56
pg_raw_parse = { git = "https://github.com/pgdogdev/pg_raw_parse.git", branch = "meskill-2026-09-24-test--wos" }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meskill let's merge the fix into main of that repo before merging it here.

bon = "3.9"
derive_more = { version = "2", features = ["display", "from"] }
schemars = { version = "1.2.1", features = ["uuid1", "chrono04", "indexmap2"] }
Expand Down
11 changes: 11 additions & 0 deletions integration/schema_sync/ecommerce_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ AS $$
SELECT COUNT(*) FROM core.users
$$;

CREATE TABLE core.timezone_source (
id BIGINT PRIMARY KEY,
summary JSONB
);

CREATE TABLE core.countries (
country_code CHAR(2) PRIMARY KEY,
country_name VARCHAR(100) NOT NULL,
Expand Down Expand Up @@ -832,6 +837,12 @@ WHERE o.status NOT IN ('cancelled', 'refunded')
AND o.created_at >= CURRENT_DATE - INTERVAL '24 months'
GROUP BY DATE_TRUNC('month', o.created_at), c.category_id, c.category_name;

CREATE VIEW analytics.timezone_dates AS
SELECT
id,
((summary ->> 'ts')::timestamptz AT TIME ZONE ((summary -> 'stop') ->> 'tz'))::date AS d
FROM core.timezone_source;

-- ============================================================================
-- FUNCTIONS AND PROCEDURES
-- ============================================================================
Expand Down
18 changes: 18 additions & 0 deletions pgdog/src/backend/schema/sync/pg_dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,24 @@ CREATE TABLE t (id bigint PRIMARY KEY);"#,
);
}

#[test]
fn test_view_time_zone_json_path_keeps_parentheses() {
let output = parse(
r#"
CREATE VIEW public.v AS
SELECT id, ((summary ->> 'ts'::text)::timestamp with time zone AT TIME ZONE ((summary -> 'stop'::text) ->> 'tz'::text))::date AS d
FROM public.s;"#,
);

let statements = output.statements(SyncState::PreData).unwrap();

assert_eq!(statements.len(), 1);
assert_eq!(
statements[0].sql,
"CREATE OR REPLACE VIEW public.v AS SELECT id, ((summary ->> 'ts'::text)::timestamp with time zone AT TIME ZONE ((summary -> 'stop'::text) ->> 'tz'::text))::date AS d FROM public.s"
);
}

#[test]
fn test_generated_identity() {
let output = parse(
Expand Down
Loading