mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
Remove unnecessary code from be_lo_put()
A permission check is performed in be_lo_put() just after returning from inv_open(), but the permission is already checked in inv_open(), so we can remove the second check. This check was added in 8d9881911f0, but then the refactoring in ae20b23a9e7 should have removed it. Author: Yugo NAGATA <nagata@sraoss.co.jp> Discussion: https://www.postgresql.org/message-id/flat/20240424185932.9789628b99a49ec81b020425%40sraoss.co.jp
This commit is contained in:
parent
aa79bde725
commit
0afa288911
@ -859,18 +859,6 @@ be_lo_put(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
lo_cleanup_needed = true;
|
lo_cleanup_needed = true;
|
||||||
loDesc = inv_open(loOid, INV_WRITE, CurrentMemoryContext);
|
loDesc = inv_open(loOid, INV_WRITE, CurrentMemoryContext);
|
||||||
|
|
||||||
/* Permission check */
|
|
||||||
if (!lo_compat_privileges &&
|
|
||||||
pg_largeobject_aclcheck_snapshot(loDesc->id,
|
|
||||||
GetUserId(),
|
|
||||||
ACL_UPDATE,
|
|
||||||
loDesc->snapshot) != ACLCHECK_OK)
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
|
||||||
errmsg("permission denied for large object %u",
|
|
||||||
loDesc->id)));
|
|
||||||
|
|
||||||
inv_seek(loDesc, offset, SEEK_SET);
|
inv_seek(loDesc, offset, SEEK_SET);
|
||||||
written = inv_write(loDesc, VARDATA_ANY(str), VARSIZE_ANY_EXHDR(str));
|
written = inv_write(loDesc, VARDATA_ANY(str), VARSIZE_ANY_EXHDR(str));
|
||||||
Assert(written == VARSIZE_ANY_EXHDR(str));
|
Assert(written == VARSIZE_ANY_EXHDR(str));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user