Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit05e27a9

Browse files
committed
Remove LEFT part of JOIN to pg_roles because of optimizer limitation:
> True, but they're not being used where you'd expect. This seems to be> something to do with the fact that it's not pg_authid which is being> accessed, but rather the view pg_roles.I looked into this and it seems the problem is that the view doesn'tget flattened into the main query because of the has_nullable_targetlistlimitation in prepjointree.c. That's triggered because pg_roles has '********'::text AS rolpasswordwhich isn't nullable, meaning it would produce wrong behavior ifreferenced above the outer join.Ultimately, the reason this is a problem is that the planner deals onlyin simple Vars while processing joins; it doesn't want to think aboutexpressions. I'm starting to think that it may be time to fix this,because I've run into several related restrictions lately, but it seemslike a nontrivial project.In the meantime, reducing the LEFT JOIN to pg_roles to a JOIN as perPeter's suggestion seems like the best short-term workaround.
1 parent7d57a18 commit05e27a9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/bin/psql/describe.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.131 2006/02/1203:22:19 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.132 2006/02/1219:31:14 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"describe.h"
@@ -194,7 +194,7 @@ describeFunctions(const char *pattern, bool verbose)
194194
"\nFROM pg_catalog.pg_proc p"
195195
"\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace"
196196
"\n LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang"
197-
"\nLEFTJOIN pg_catalog.pg_roles r ON r.oid = p.proowner\n");
197+
"\n JOIN pg_catalog.pg_roles r ON r.oid = p.proowner\n");
198198

199199
/*
200200
* we skip in/out funcs by excluding functions that take or return cstring
@@ -367,7 +367,7 @@ listAllDbs(bool verbose)
367367
_("Description"));
368368
appendPQExpBuffer(&buf,
369369
"\nFROM pg_catalog.pg_database d"
370-
"\nLEFTJOIN pg_catalog.pg_roles r ON d.datdba = r.oid\n"
370+
"\n JOIN pg_catalog.pg_roles r ON d.datdba = r.oid\n"
371371
"ORDER BY 1;");
372372

373373
res=PSQLexec(buf.data, false);
@@ -1485,7 +1485,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
14851485

14861486
appendPQExpBuffer(&buf,
14871487
"\nFROM pg_catalog.pg_class c"
1488-
"\nLEFTJOIN pg_catalog.pg_roles r ON r.oid = c.relowner"
1488+
"\n JOIN pg_catalog.pg_roles r ON r.oid = c.relowner"
14891489
"\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace");
14901490
if (showIndexes)
14911491
appendPQExpBuffer(&buf,
@@ -1727,7 +1727,7 @@ listSchemas(const char *pattern, bool verbose)
17271727
_("Access privileges"),_("Description"));
17281728

17291729
appendPQExpBuffer(&buf,
1730-
"\nFROM pg_catalog.pg_namespace nLEFTJOIN pg_catalog.pg_roles r\n"
1730+
"\nFROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_roles r\n"
17311731
" ON n.nspowner=r.oid\n"
17321732
"WHERE(n.nspname !~ '^pg_temp_' OR\n"
17331733
" n.nspname = (pg_catalog.current_schemas(true))[1])\n");/* temp schema is first */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp