Hi I am migrating from mssql server to Postgres, so kindly can anyone please help me with what are things I need to change
when modifying a stored procedure from mssql to postgres, here I am giving my mssql procedure for reference.

--------------------------------

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


--[Validate_User] 'Mudassar', '12345'

ALTER PROCEDURE [dbo].[Validate_User]
@Username NVARCHAR(MAX),
@Password NVARCHAR(MAX)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @UserId INT, @LastLoginDate DATETIME, @RoleId INT

SELECT @UserId = UserId, @LastLoginDate = LastLoginDate, @RoleId = RoleId
FROM tblUsers WHERE Username = @Username AND [Password] = @Password

IF @UserId IS NOT NULL
BEGIN
IF NOT EXISTS(SELECT UserId FROM tblUserActivation WHERE UserId = @UserId)
BEGIN
UPDATE tblUsers
SET LastLoginDate = GETDATE()
WHERE UserId = @UserId

SELECT @UserId [UserId],
(SELECT RoleName FROM Roles
WHERE RoleId = @RoleId) [Roles] -- User Valid
END
ELSE
BEGIN
SELECT -2 -- User not activated.
END
END
ELSE
BEGIN
SELECT -1 -- User invalid.
END
END