Remove postgresql_fdw_connections view.
authorShigeru Hanada <[email protected]>
Wed, 13 Oct 2010 13:35:24 +0000 (22:35 +0900)
committerShigeru Hanada <[email protected]>
Wed, 13 Oct 2010 13:35:24 +0000 (22:35 +0900)
contrib/postgresql_fdw/expected/postgresql_fdw.out
contrib/postgresql_fdw/fsconnection.c
contrib/postgresql_fdw/postgresql_fdw.sql.in
contrib/postgresql_fdw/sql/postgresql_fdw.sql
contrib/postgresql_fdw/uninstall_postgresql_fdw.sql
doc/src/sgml/postgresql-fdw.sgml

index bcf3010f2e19fa32e601f0ca069b8f07de5eda05..3cfa2f8bf1ef9351cb8fe783bf0475c2d85fc2e2 100644 (file)
@@ -48,12 +48,6 @@ ERROR:  could not connect to server
 DETAIL:  FATAL:  role "invalid" does not exist
 
 ALTER USER MAPPING FOR PUBLIC SERVER loopback2 OPTIONS (DROP user);
-SELECT * FROM postgresql_fdw_connections ORDER BY conname;
-  conname  |  srvname  | usename 
------------+-----------+---------
- loopback1 | loopback1 | public
-(1 row)
-
 SELECT * FROM ft2 ORDER BY c1; -- ERROR
 ERROR:  could not execute foreign query
 DETAIL:  ERROR:  relation "public.invalid" does not exist
@@ -61,13 +55,6 @@ LINE 1: SELECT c1, c2, c3 FROM public.invalid ft2
                                ^
 
 HINT:  SELECT c1, c2, c3 FROM public.invalid ft2
-SELECT * FROM postgresql_fdw_connections ORDER BY conname;
-  conname  |  srvname  | usename 
------------+-----------+---------
- loopback1 | loopback1 | public
- loopback2 | loopback2 | public
-(2 rows)
-
 ALTER FOREIGN TABLE ft2 OPTIONS (SET relname 't1');
 SELECT * FROM ft2 ORDER BY c1;
  c1 | c2  |     c3     
@@ -77,13 +64,6 @@ SELECT * FROM ft2 ORDER BY c1;
   3 | buz | 01-03-1970
 (3 rows)
 
-SELECT * FROM postgresql_fdw_connections ORDER BY conname;
-  conname  |  srvname  | usename 
------------+-----------+---------
- loopback1 | loopback1 | public
- loopback2 | loopback2 | public
-(2 rows)
-
 -- query using join
 SELECT * FROM ft1 JOIN ft2 ON (ft1.c1 = ft2.c1) ORDER BY ft1.c1;
  c1 | c2  |     c3     | c1 | c2  |     c3     
index 62e50fdb2dbe4b63e69692d41185061349345965..3d55599ca3305b7320342f894200a72d6ee2cf18 100644 (file)
@@ -22,9 +22,6 @@
 
 #include "fsconnection.h"
 
-extern Datum postgresql_fdw_connections(PG_FUNCTION_ARGS);
-
-
 /*
  * Connection cache entry managed with hash table.
  */
@@ -182,75 +179,6 @@ DisconnectAll(void)
    FSConnectionHash = NULL;
 }
 
-/*
- * Retrieve foreign server connections.
- */
-Datum
-postgresql_fdw_connections(PG_FUNCTION_ARGS)
-{
-#define PG_FOREIGN_SERVER_CONNECTIONS_COLS     3
-   ReturnSetInfo      *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
-   TupleDesc           tupdesc;
-   Tuplestorestate    *tupstore;
-   MemoryContext       per_query_ctx;
-   MemoryContext       oldcontext;
-
-   /* check to see if caller supports us returning a tuplestore */
-   if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
-       ereport(ERROR,
-               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                errmsg("set-valued function called in context that cannot accept a set")));
-   if (!(rsinfo->allowedModes & SFRM_Materialize))
-       ereport(ERROR,
-               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                errmsg("materialize mode required, but it is not " \
-                       "allowed in this context")));
-
-   /* Build a tuple descriptor for our result type */
-   if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
-       elog(ERROR, "return type must be a row type");
-
-   per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;
-   oldcontext = MemoryContextSwitchTo(per_query_ctx);
-
-   tupstore = tuplestore_begin_heap(true, false, work_mem);
-   rsinfo->returnMode = SFRM_Materialize;
-   rsinfo->setResult = tupstore;
-   rsinfo->setDesc = tupdesc;
-
-   if (FSConnectionHash)
-   {
-       HASH_SEQ_STATUS     hash_seq;
-       ConnCacheEntry     *entry;
-
-       MemoryContextSwitchTo(oldcontext);
-
-       hash_seq_init(&hash_seq, FSConnectionHash);
-       while ((entry = hash_seq_search(&hash_seq)) != NULL)
-       {
-           Datum       values[PG_FOREIGN_SERVER_CONNECTIONS_COLS];
-           bool        nulls[PG_FOREIGN_SERVER_CONNECTIONS_COLS];
-           int         i = 0;
-
-           memset(values, 0, sizeof(values));
-           memset(nulls, 0, sizeof(nulls));
-
-           values[i++] = CStringGetTextDatum(entry->name);
-           values[i++] = ObjectIdGetDatum(entry->serverid);
-           values[i++] = ObjectIdGetDatum(entry->userid);
-
-           Assert(i == PG_FOREIGN_SERVER_CONNECTIONS_COLS);
-
-           tuplestore_putvalues(tupstore, tupdesc, values, nulls);
-       }
-   }
-
-   /* clean up and return the tuplestore */
-   tuplestore_donestoring(tupstore);
-
-   return (Datum) 0;
-}
-
 /*
  * Disconnect all connections on the exit of backend process.
  */
index be6e23e77e8ba677a85a9911e83b5b5d08c352c2..5afd418b4070cdee61b7325a8b3ef24e705c40e9 100644 (file)
@@ -7,24 +7,3 @@ CREATE OR REPLACE FUNCTION postgresql_fdw_handler ()
 RETURNS fdw_handler
 AS 'MODULE_PATHNAME','postgresql_fdw_handler'
 LANGUAGE C STRICT;
-
-CREATE OR REPLACE FUNCTION postgresql_fdw_connections(conname OUT text, serverid OUT oid, userid OUT oid)
-    RETURNS SETOF record
-    AS 'MODULE_PATHNAME','postgresql_fdw_connections'
-    LANGUAGE C STRICT;
-
-CREATE OR REPLACE VIEW postgresql_fdw_connections AS
-    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 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;
-
index d600c63bb43d59c1e851f3acbf10f44f85453026..43db5ddd09dba279e6e4fff1789a2da48e0a853c 100644 (file)
@@ -54,12 +54,9 @@ CREATE FOREIGN TABLE ft2 (
 SELECT * FROM ft1 ORDER BY c1;
 SELECT * FROM ft2 ORDER BY c1; -- ERROR
 ALTER USER MAPPING FOR PUBLIC SERVER loopback2 OPTIONS (DROP user);
-SELECT * FROM postgresql_fdw_connections ORDER BY conname;
 SELECT * FROM ft2 ORDER BY c1; -- ERROR
-SELECT * FROM postgresql_fdw_connections ORDER BY conname;
 ALTER FOREIGN TABLE ft2 OPTIONS (SET relname 't1');
 SELECT * FROM ft2 ORDER BY c1;
-SELECT * FROM postgresql_fdw_connections ORDER BY conname;
 
 -- query using join
 SELECT * FROM ft1 JOIN ft2 ON (ft1.c1 = ft2.c1) ORDER BY ft1.c1;
index a124d654558df9b6453d4350b899f77db2a6b32e..1f6d660dafb18f28ad91c6b1571180d090cf2077 100644 (file)
@@ -4,6 +4,3 @@
 set search_path = public;
 
 DROP FUNCTION postgresql_fdw_handler ();
-DROP VIEW postgresql_fdw_connections;
-DROP FUNCTION postgresql_fdw_connections(conname OUT text, serverid OUT oid, userid OUT oid);
-
index a9f9ab9314b56d0e31839acc915b39982fb8de61..0d7791010c8c7afeb65db8d2456f91ccd411daa9 100644 (file)
     </listitem>
    </varlistentry>
 
-   <varlistentry>
-    <term>
-     <function>postgresql_fdw_connections() returns record</function>
-    </term>
-
-    <listitem>
-     <para>
-      <function>postgresql_fdw_connections</function> is a function which
-      returns list of active connections which are estabilshed via
-      postgresql_fdw.  This function was designed as a private function, used
-      from postgresql_fdw_connections view.
-     </para>
-    </listitem>
-   </varlistentry>
-
-  </variablelist>
-
- </sect2>
-
- <sect2>
-  <title>Views</title>
-
-  <variablelist>
-   <varlistentry>
-    <term>
-     <function>postgresql_fdw_connections</function>
-    </term>
-
-    <listitem>
-     <para>
-      <structname>postgresql_fdw_connections</structname> is a view which
-      shows active connections which are estabilshed via postgresql_fdw.
-     </para>
-
-     <table>
-      <title><structname>postgresql_fdw_connections</> Columns</title>
-      <tgroup cols="4">
-       <thead>
-        <row>
-         <entry>Name</entry>
-         <entry>Type</entry>
-         <entry>References</entry>
-         <entry>Description</entry>
-        </row>
-       </thead>
-       <tbody>
-        <row>
-         <entry><structfield>conname</structfield></entry>
-         <entry><type>name</type></entry>
-         <entry></entry>
-         <entry>Name of the connection</entry>
-        </row>
-   
-        <row>
-         <entry><structfield>srvname</structfield></entry>
-         <entry><type>name</type></entry>
-         <entry>pg_foreign_server.srvname</entry>
-         <entry>Name of the foreign server used by this connection</entry>
-        </row>
-        <row>
-         <entry><structfield>usename</structfield></entry>
-         <entry><type>name</type></entry>
-         <entry>pg_authid.rolname</entry>
-         <entry>Name of the user being mapped, or <literal>PUBLIC</literal> if
-         the mapping is public</entry>
-        </row>
-       </tbody>
-      </tgroup>
-     </table>
-
-    </listitem>
-   </varlistentry>
   </variablelist>
 
  </sect2>