Skip to content

Commit

Permalink
add new sql stored procedure
Browse files Browse the repository at this point in the history
This postgresql stored procedure marks a dataset as deleted
  • Loading branch information
the42 committed Oct 12, 2014
1 parent 947fae4 commit 10576d1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sql/markdatasetdeleted.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

CREATE OR REPLACE FUNCTION markdatasetdeleted(IN inckanid character varying, IN stime timestamp with time zone)
RETURNS status.sysid%TYPE AS
$BODY$
DECLARE
retid status.sysid%TYPE;
BEGIN
INSERT INTO status(datasetid, hittime, status)
SELECT sysid, stime, 'deleted'
FROM dataset
WHERE ckanid = inckanid
RETURNING sysid INTO retid;
RETURN retid;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;

0 comments on commit 10576d1

Please sign in to comment.