Wednesday, August 5, 2026
  • Login
  • Register
Technology Tutorials & Latest News | ByteBlock
  • Home
  • Tech News
  • Tech Tutorials
    • Networking
    • Computers
    • Mobile Devices & Tablets
    • Apps & Software
    • Cloud & Servers
    • IT Careers
    • AI
  • Reviews
  • Shop
    • Electronics & Gadgets
    • Apps & Software
    • Online Courses
    • Lifetime Subscription
No Result
View All Result
Tech Insight: Tutorials, Reviews & Latest News
No Result
View All Result
Home News Google

Automating Postgres translations with Database Migration Service

August 5, 2026
in Google
0 0
0

In the Medium blog post, “From MARS to SETOF REFCURSOR: Migrating Multi-Result Stored Procedures to PostgreSQL,” we explored the fundamental architectural differences between SQL Server and PostgreSQL regarding multiple result sets. We looked at how SQL Server natively streams multiple tabular streams from a single execution, whereas PostgreSQL requires a more deliberate strategy using explicit cursor manipulation.

If you’re facing a massive database migration with hundreds of these procedures, manually rewriting them is a non-starter. This is where automated tools come in. In this post, we’ll explore in detail how Google Cloud’s Database Migration Service (DMS) approaches this exact challenge, the conversion logic it applies under the hood, and how to actually run and test the generated code.

The Core Conversion Strategy of DMS

There are many reasons to migrate your databases to PostgreSQL, including enterprise performance and availability, a thriving developer and user community, and strong AI capabilities. But tricky queries, like those with multiple result sets, can slow down your migration project.

DMS looks at two specific things: How many result sets does the procedure return? and Does it use a scalar RETURN value?

The decision matrix for the translation looks like this:

Scenario

SQL Server Characteristic

PostgreSQL Target Object

Mechanism

Scenario A

1 Result Set OR a Scalar Return Value only

STORED PROCEDURE

Handled natively via an INOUT refcursor parameter or standard variable tracking.

Scenario B

Multiple Result Sets OR a combination of Result Sets + Scalar Return

FUNCTION

Converted to a RETURNS SETOF refcursor block. The scalar return value is appended as its own separate cursor dataset.

Automating Multi-Result Set Conversions: Inside DMS 

SQL Server utilizes a tabular data stream protocol that allows multiple results to be transmitted over a single connection execution path without explicit declarations. PostgreSQL, by contrast, relies on a distinct execution protocol where multiple datasets are managed deterministically via cursors. To bridge this structural difference, DMS automates the translation logic. 

Consider a baseline healthcare reporting scenario. We have a master procedure (sp_GetPatientSummary) that orchestrates data retrieval for a patient by conditionally calling two child procedures: one for lab results (sp_GetPatientLabResults) and one for clinical visits (sp_GetPatientDoctorVisits).

Depending on conditional logic and procedural execution paths, a single execution can return up to four distinct result sets plus a status integer indicating whether the patient was found.

SQL

ShareTweetShare
Previous Post

How Target Rebuilt Retail Discovery with Spanner Graph

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You might also like

Automating Postgres translations with Database Migration Service

August 5, 2026

How Target Rebuilt Retail Discovery with Spanner Graph

August 4, 2026

Unlocking agility in banking with an API-ready ecosystem at Deutsche Bank

August 4, 2026

Best WiFi Router For A Large Home | 2024

June 25, 2024

How to Set Up a Wireless Router as an Access Point

June 25, 2024
The LG MyView branding, which is making its debut in 2024, communicates the personalized user experience delivered by the company’s premium smart monitors.

LG MyView Smart Monitor Review

June 24, 2024
monotone logo block byte

Stay ahead in the tech world with Tech Insight. Explore in-depth tutorials, unbiased reviews, and the latest news on gadgets, software, and innovations. Join our community of tech enthusiasts today!

Stay Connected

  • Home
  • Tech News
  • Tech Tutorials
  • Reviews
  • Shop
  • About Us
  • Privacy Policy
  • Terms & Conditions

© 2024 Byte Block - Tech Insight: Tutorials, Reviews & Latest News. Made By Huwa.

Welcome Back!

Sign In with Google
Sign In with Linked In
OR

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Sign Up with Google
Sign Up with Linked In
OR

Fill the forms below to register

*By registering into our website, you agree to the Terms & Conditions and Privacy Policy.
All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
  • Login
  • Sign Up
  • Cart
No Result
View All Result
  • Home
  • Tech News
  • Tech Tutorials
    • Networking
    • Computers
    • Mobile Devices & Tablets
    • Apps & Software
    • Cloud & Servers
    • IT Careers
    • AI
  • Reviews
  • Shop
    • Electronics & Gadgets
    • Apps & Software
    • Online Courses
    • Lifetime Subscription

© 2024 Byte Block - Tech Insight: Tutorials, Reviews & Latest News. Made By Huwa.

Login