Cloud-Plattformen · 04.08.2026, 16:18 UTC
Multiple result sets: How Database Migration Service automates SQL server to PostgreSQL translation
| Schweregrad | info |
|---|---|
| Kategorie | Cloud-Plattformen |
| Quelle | Google Cloud Blog ↗ |
| Veröffentlicht | 04.08.2026 UTC |
Sicherheitsmeldung mit Schweregrad noch nicht bewertet. Technische Details im Tab „Originaltext“; empfohlene Schritte in der Checkliste.
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 + …