From: Shigeru Hanada Date: Wed, 13 Oct 2010 12:17:34 +0000 (+0900) Subject: Fix postgresql_fdw_connections view to not use COALESCE but CASE WHEN. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=b5fc84921f78cc8c1a6ca44e97447cb5d4991a4e;p=users%2Fhanada%2Fpostgres.git Fix postgresql_fdw_connections view to not use COALESCE but CASE WHEN. --- diff --git a/contrib/postgresql_fdw/postgresql_fdw.sql.in b/contrib/postgresql_fdw/postgresql_fdw.sql.in index 60f26a2817..be6e23e77e 100644 --- a/contrib/postgresql_fdw/postgresql_fdw.sql.in +++ b/contrib/postgresql_fdw/postgresql_fdw.sql.in @@ -14,12 +14,16 @@ CREATE OR REPLACE FUNCTION postgresql_fdw_connections(conname OUT text, serverid LANGUAGE C STRICT; CREATE OR REPLACE VIEW postgresql_fdw_connections AS - SELECT c.conname as conname, - s.srvname as srvname, - COALESCE(a.rolname, 'public') as usename + SELECT c.conname AS conname, + s.srvname AS srvname, + CASE WHEN c.userid = 0 THEN + 'public' + ELSE + a.rolname + END AS usename FROM postgresql_fdw_connections() c JOIN pg_foreign_server s ON (s.oid = c.serverid) - LEFT OUTER JOIN pg_authid a ON (a.oid = c.userid); + LEFT JOIN pg_authid a ON (a.oid = c.userid); GRANT EXECUTE ON FUNCTION postgresql_fdw_connections(conname OUT text, serverid OUT oid, userid OUT oid) TO public; GRANT SELECT ON postgresql_fdw_connections TO public;