[英]Get the actual data of the large object using non-superuser account
Environment : PostgreSQL 9.1 环境:PostgreSQL 9.1
Prior to pg 9.0 , getting the actual data of a large object TEXT
field can be done by selecting the corresponding record from the pg_largeobject
table . 在pg 9.0之前,可以通过从
pg_largeobject
表中选择相应的记录来获得大对象TEXT
字段的实际数据。 But since pg 9.0 , non-superuser does not allow to access this table anymore. 但是从pg 9.0开始,非超级用户不再允许访问该表。
However, by using hibernate ,the same non-superuser account can access the actual data of this TEXT
field .So I believe using non-superuser account can also "SELECT" the actual content of this TEXT field. 但是,通过使用休眠模式,相同的非超级用户帐户可以访问此
TEXT
字段的实际数据。因此,我相信使用非超级用户帐户也可以“选择”此TEXT字段的实际内容。 How can I do it? 我该怎么做?
As suggested by Craig , I turn on log collection by setting log_statement = 'all'
and the related log are : 根据Craig的建议,我通过设置
log_statement = 'all'
打开日志收集,相关的日志为:
SELECT p.proname,p.oid
FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n
WHERE p.pronamespace=n.oid AND n.nspname='pg_catalog'
AND ( proname = 'lo_open' or proname = 'lo_close' or proname = 'lo_creat' or proname = 'lo_unlink'
or proname = 'lo_lseek' or proname = 'lo_tell' or proname = 'loread' or proname = 'lowrite'
or proname = 'lo_truncate')
2012-08-31 09:27:05 HKT LOG: fastpath function call: "lo_open" (OID 952)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "lo_open" (OID 952)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "lo_lseek" (OID 956)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "lo_tell" (OID 958)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "lo_lseek" (OID 956)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "lo_tell" (OID 958)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "lo_lseek" (OID 956)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "loread" (OID 954)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "loread" (OID 954)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "loread" (OID 954)
2012-08-31 09:27:05 HKT LOG: fastpath function call: "lo_close" (OID 953)
It calls several lo_XXX() functions but I have no idea how to make it as a PL/pgSQL function such that I can simply call it in the select statement . 它调用了几个lo_XXX()函数,但是我不知道如何将其设置为PL / pgSQL函数,这样我就可以在select语句中简单地对其进行调用。
Thanks. 谢谢。
Why not have a look at what Hibernate is doing? 为什么不看看Hibernate在做什么呢?
In postgresql.conf
set log_statement = 'all'
and reload or restart PostgreSQL. 在
postgresql.conf
设置log_statement = 'all'
并重新加载或重启PostgreSQL。 Re-run your test in Hibernate and see what's going on. 在Hibernate中重新运行测试,看看发生了什么。
At a guess I'd say Hibernate is using the large object client interfaces, specifically PgJDBC's large object support . 大概我会说Hibernate使用的是大对象客户端接口,特别是PgJDBC的大对象支持 。 Alternately it might be using the JDBC-standard clob/blob interfaces to access the data.
或者,它可能正在使用JDBC标准的clob / blob接口来访问数据。
Reading the documentation about large objects I encountered the answer to your question: lo_compat_privileges, which is a variable in postgresql.conf. 在阅读有关大型对象的文档时,我遇到了您的问题的答案:lo_compat_privileges,这是postgresql.conf中的变量。 This variable can have the values on or off.
此变量可以具有打开或关闭的值。 Default is off, on is what you were expecting.
默认为关闭,开启为您所期望的。 With the default value performs Postgresql security checks, which were not existing prior to version 9.0.
使用默认值执行9.0版本之前不存在的Postgresql安全检查。 If this variable has the value 'on' are the majority of the new security checks not performed: http://www.postgresql.org/docs/9.2/static/runtime-config-compatible.html#GUC-LO-COMPAT-PRIVILEGES .
如果此变量的值为“ on”,则大多数新的安全检查不会执行: http : //www.postgresql.org/docs/9.2/static/runtime-config-compatible.html#GUC-LO-COMPAT-特权 。
The security checks are there to stay in postgresql, hence will the best solution to let the new security checks be enabled and work with GRANT options. 安全检查留在了postgresql中,因此将是启用新安全检查并与GRANT选项一起使用的最佳解决方案。
With kind regards, 亲切的问候,
Loek ek
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.