I am migrating my application from SQL Server to Postgres 11. I am not able to find any solution for migrating procedure.
ALTER PROCEDURE [dbo].[sp_DeleteAttachmentsForArtefacts]
@artefactTypeId BIGINT,
@artefactIds IdListTable READONLY
AS
BEGIN
SET NOCOUNT ON;
DELETE tbl_Resources_Attachment
WHERE ContextTypeId = @artefactTypeId
AND ContextId IN (SELECT Id FROM @artefactIds)
END
CREATE TYPE [dbo].[IdListTable] AS TABLE
(
[Id] [BIGINT] NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC) WITH (IGNORE_DUP_KEY = OFF)
)
I have created userdefined type in Postgres. But it is not working in "select Id from @artefactIds". It is giving error "artefactIds" doesn't exit.