列表视图 [英] Listing views

查看:105
本文介绍了列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在尝试列出视图,从输出中删除内部视图。

使用7.2,我发现了这个简单的声明:

SELECT viewname FROM pg_views WHERE viewname!〜''^ pg_'';


它工作正常,忽略了23个pg_ *表。我得到了我的实际观点。


但是,使用7.4,我得到了很多(大约30)个系统视图,如table_constraints,

table_privileges,tables等等...而且这些没有任何''pg''前缀。


你知道一些能够正确列出视图的查询吗?它正在运行


-

og


----- ----------------------(播出结束)----------------------- ----

提示9:如果您的

加入列的数据类型不匹配,计划者将忽略您选择索引扫描的愿望

解决方案



怎么样

mydb =#\dv

??

不行也不错。我没有看到任何pg视图。

问候,

Kaloyan


Olivier Guilyardi写道:
< blockquote class =post_quotes>

我正在尝试列出视图,从输出中删除内部视图。
使用7.2,我发现了这个简单的声明:
SELECT viewname FROM pg_views WHERE viewname!~'' ^ pg_'';

它工作正常,忽略了23个pg_ *表。我得到了我的实际意见
返回。

但是,使用7.4,我得到了很多(大约30)个系统视图,如
table_constraints,
table_privileges,tables等等......而且这些没有任何''pg''前缀。

你知道一些能够正确列出视图的查询,不管它是运行吗? Postgresql 7.4或7.2及更低版本?
-
og

--------------------- ------(广播结束)---------------------------
提示9:计划者会忽略你的如果您的
加入列的数据类型不匹配,则选择索引扫描的愿望




----- ----------------------(播出结束)----------------------- ----

提示5:您查看了我们广泛的常见问题解答吗?

http://www.postgresql.org/docs/faqs/FAQ.html

2004年8月10日星期二0 3:14,Olivier Guilyardi写道:

SELECT viewname FROM pg_views WHERE viewname!~'' ^ pg _'';



with 7.4:


SELECT viewname FROM pg_views WHERE schemaname NOT IN

(''pg_catalog'',''information_schema'');


艾伯特


---------------------------(播出结束)----- ----------------------

提示3:如果通过Usenet发布/阅读,请发送适当的

subscribe-nomail命令 ma*******@postgresql.org 以便您的

消息可以干净地通过邮件列表


Olivier Guilyardi< ml@xung.org>写道:

好的,这就是我的想法:识别服务器版本的初始小查询,以便后续查询可以相应调整......

但是,因为这个Postgresql版本是什么?查询是由我感兴趣的库默默执行的,主机
应用程序不应该知道的,必须确保它不会破坏:是版本()的方式去?对于限制性很强的用户帐户,是否存在一些权限问题?一些
更好_only-one-query_方式识别服务器版本/功能




''SELECT version();''应该工作。调用该函数将没有权限问题

,除非你以这种方式设置数据库 - 它

默认具有PUBLIC执行权限。


-Doug

-

让我们越过河流,在树荫下休息。

--T。 J. Jackson,1863


---------------------------(播出结束) - --------------------------

提示3:如果通过Usenet发布/阅读,请发送适当的

subscribe-nomail命令 ma*******@postgresql.org ,以便您的

消息可以干净地通过邮件列表


Hi,

I''m trying to list views, eliminating internal ones from the output.
Using 7.2, I found this simple statement :
SELECT viewname FROM pg_views WHERE viewname !~ ''^pg_'';

It works fine, ignoring 23 pg_* tables. And I get my actual views returned.

But, with 7.4, I get many (about 30) more system views, as table_constraints,
table_privileges, tables, etc... And these do not have any ''pg'' prefix.

Do you know of some query that would properly list views, wether it''s running
on Postgresql 7.4 or 7.2 and lower ?
--
og

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match

解决方案

Hi,
What about
mydb=# \dv
??
Doesn''t it works fine. I don''t see any pg views.
Regards,
Kaloyan

Olivier Guilyardi wrote:

Hi,

I''m trying to list views, eliminating internal ones from the output.
Using 7.2, I found this simple statement :
SELECT viewname FROM pg_views WHERE viewname !~ ''^pg_'';

It works fine, ignoring 23 pg_* tables. And I get my actual views
returned.

But, with 7.4, I get many (about 30) more system views, as
table_constraints,
table_privileges, tables, etc... And these do not have any ''pg'' prefix.

Do you know of some query that would properly list views, wether it''s
running
on Postgresql 7.4 or 7.2 and lower ?
--
og

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
joining column''s datatypes do not match



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


On Tuesday 10 August 2004 03:14, Olivier Guilyardi wrote:

SELECT viewname FROM pg_views WHERE viewname !~ ''^pg_'';


with 7.4 :

SELECT viewname FROM pg_views WHERE schemaname NOT IN
(''pg_catalog'',''information_schema'');

Albert

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly


Olivier Guilyardi <ml@xung.org> writes:

Okay, that''s what I thought : an initial little query to identify the server
version, so that subsequent queries can be adapted accordingly...

But, since this "What Postgresql version is this ?" query is
silently performed by the library I''m interested in, what the host
application is not supposed to know, it must be ensured that it''s
not going to break : is version() the way to go ? Could there be
some permission issues with very restrictive user accounts ? Some
better _only-one-query_ way to identify the server version/features
?



''SELECT version();'' should work. There will be no permission issues
with calling that function unless you set the database up that way--it
has PUBLIC execute permission by default.

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
--T. J. Jackson, 1863

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly


这篇关于列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆