12 lines
415 B
PL/PgSQL
12 lines
415 B
PL/PgSQL
CREATE OR REPLACE FUNCTION storage.can_insert_object(bucketid text, name text, owner uuid, metadata jsonb)
|
|
RETURNS VOID
|
|
LANGUAGE plpgsql
|
|
AS $$
|
|
BEGIN
|
|
INSERT INTO "storage"."objects" ("bucket_id", "name", "owner", "metadata") VALUES (bucketid, name, owner, metadata);
|
|
-- hack to rollback the successful insert
|
|
RAISE sqlstate 'PT200' using
|
|
message = 'ROLLBACK',
|
|
detail = 'rollback successful insert';
|
|
END
|
|
$$; |