Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken PostgreSQL functions for replay of delegation change events #1070

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/Authorization/Migration/v0.07/01-setup-procedures.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
-- Function: select_delegationchanges_by_id_range
DROP FUNCTION IF EXISTS delegation.select_delegationchanges_by_id_range(bigint, bigint);

CREATE OR REPLACE FUNCTION delegation.select_delegationchanges_by_id_range(
_startid bigint,
_endid bigint DEFAULT '9223372036854775807'::bigint)
RETURNS SETOF delegation.delegationchanges
RETURNS TABLE(
delegationchangeid integer,
delegationchangetype delegation.delegationchangetype,
altinnappid text,
offeredbypartyid integer,
coveredbypartyid integer,
coveredbyuserid integer,
performedbyuserid integer,
blobstoragepolicypath text,
blobstorageversionid text,
created timestamp with time zone)
LANGUAGE 'sql'
COST 100
STABLE PARALLEL SAFE
Expand Down
12 changes: 11 additions & 1 deletion src/Authorization/Migration/v0.08/01-setup-procedures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,17 @@ CREATE OR REPLACE FUNCTION delegation.get_current_change(
_offeredbypartyid integer,
_coveredbyuserid integer,
_coveredbypartyid integer)
RETURNS SETOF delegation.delegationchanges
RETURNS TABLE(
delegationchangeid integer,
delegationchangetype delegation.delegationchangetype,
altinnappid text,
offeredbypartyid integer,
coveredbypartyid integer,
coveredbyuserid integer,
performedbyuserid integer,
blobstoragepolicypath text,
blobstorageversionid text,
created timestamp with time zone)
LANGUAGE 'sql'
COST 100
STABLE PARALLEL SAFE
Expand Down
40 changes: 40 additions & 0 deletions src/Authorization/Migration/v0.09/01-setup-procedures.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- Function: select_delegationchanges_by_id_range
-- Broken PostgreSQL functions for replay of delegation change events #1069
DROP FUNCTION IF EXISTS delegation.select_delegationchanges_by_id_range(bigint, bigint);

CREATE OR REPLACE FUNCTION delegation.select_delegationchanges_by_id_range(
_startid bigint,
_endid bigint DEFAULT '9223372036854775807'::bigint)
RETURNS TABLE(
delegationchangeid integer,
delegationchangetype delegation.delegationchangetype,
altinnappid text,
offeredbypartyid integer,
coveredbypartyid integer,
coveredbyuserid integer,
performedbyuserid integer,
blobstoragepolicypath text,
blobstorageversionid text,
created timestamp with time zone)
LANGUAGE 'sql'
COST 100
STABLE PARALLEL SAFE
ROWS 1000

AS $BODY$

SELECT
delegationChangeId,
delegationChangeType,
altinnAppId,
offeredByPartyId,
coveredByPartyId,
coveredByUserId,
performedByUserId,
blobStoragePolicyPath,
blobStorageVersionId,
created
FROM delegation.delegationChanges
WHERE
delegationChangeId BETWEEN _startId AND _endId
$BODY$;
Loading