SQL Server Common Library Runtime and PostgreSQL PL/Perl - SQL Server to Aurora PostgreSQL Migration Playbook
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

SQL Server Common Library Runtime and PostgreSQL PL/Perl

Feature compatibility Amazon SCT / Amazon DMS automation level Amazon SCT action code index Key differences


                              One star feature compatibility


                              No automation

N/A

Migrating CLR objects requires a full code rewrite.

SQL Server Usage

SQL Server provides the capability of implementing .NET objects in the database using the Common Runtime Library (CLR). The CLR enables development of functionality that would be complicated using T-SQL.

The CLR provides robust solutions for string manipulation, date manipulation, and calling external services such as Windows Communication Foundation (WCF) services and web services.

You can create the following objects with the EXTERNAL NAME clause:

PostgreSQL Usage

Amazon Aurora PostgreSQL-Compatible Edition (Aurora PostgreSQL) doesn’t support .NET code. However, you can create Perl functions. In this case, convert all C# code to PL/pgSQL or PL/Perl.

To use PL/Perl language, install the Perl extension:

CREATE EXTENSION plperl;

After you install the Perl extension, you can create functions using Perl code. Specify plperl in the LANGUAGE clause.

You can create the following objects with Perl:

  • Functions.

  • Void functions or procedures.

  • Triggers.

  • Event Triggers.

  • Values for session level.

Examples

The following example creates a function that returns the greater value of two integers.

CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS $$
  if ($_[0] > $_[1]) { return $_[0]; }
  return $_[1];
$$ LANGUAGE plperl;

For more information, see PL/Perl — Perl Procedural Language in the PostgreSQL documentation.