Commit cae565e5 authored by Peter Eisentraut's avatar Peter Eisentraut

SQL/MED catalog manipulation facilities

This doesn't do any remote or external things yet, but it gives modules
like plproxy and dblink a standardized and future-proof system for
managing their connection information.

Martin Pihlak and Peter Eisentraut
parent 1eec10a2
This diff is collapsed.
<!-- $PostgreSQL: pgsql/doc/src/sgml/features.sgml,v 2.29 2008/11/27 12:12:02 petere Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/features.sgml,v 2.30 2008/12/19 16:25:16 petere Exp $ -->
<appendix id="features">
<title>SQL Conformance</title>
......@@ -71,11 +71,11 @@
</para>
<para>
The <productname>PostgreSQL</productname> core covers parts 1, 2,
The <productname>PostgreSQL</productname> core covers parts 1, 2, 9,
11, and 14. Part 3 is covered by the ODBC driver, and part 13 is
covered by the PL/Java plug-in, but exact conformance is currently
not being verified for these components. There are currently no
implementations of parts 4, 9, and 10
implementations of parts 4 and 10
for <productname>PostgreSQL</productname>.
</para>
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.462 2008/12/18 18:20:33 tgl Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.463 2008/12/19 16:25:16 petere Exp $ -->
<chapter id="functions">
<title>Functions and Operators</title>
......@@ -11335,6 +11335,21 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
<entry><type>boolean</type></entry>
<entry>does current user have privilege for database</entry>
</row>
<row>
<entry><literal><function>has_foreign_data_wrapper_privilege</function>(<parameter>user</parameter>,
<parameter>fdw</parameter>,
<parameter>privilege</parameter>)</literal>
</entry>
<entry><type>boolean</type></entry>
<entry>does user have privilege for foreign-data wrapper</entry>
</row>
<row>
<entry><literal><function>has_foreign_data_wrapper_privilege</function>(<parameter>fdw</parameter>,
<parameter>privilege</parameter>)</literal>
</entry>
<entry><type>boolean</type></entry>
<entry>does current user have privilege for foreign-data wrapper</entry>
</row>
<row>
<entry><literal><function>has_function_privilege</function>(<parameter>user</parameter>,
<parameter>function</parameter>,
......@@ -11380,6 +11395,21 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
<entry><type>boolean</type></entry>
<entry>does current user have privilege for schema</entry>
</row>
<row>
<entry><literal><function>has_server_privilege</function>(<parameter>user</parameter>,
<parameter>server</parameter>,
<parameter>privilege</parameter>)</literal>
</entry>
<entry><type>boolean</type></entry>
<entry>does user have privilege for foreign server</entry>
</row>
<row>
<entry><literal><function>has_server_privilege</function>(<parameter>server</parameter>,
<parameter>privilege</parameter>)</literal>
</entry>
<entry><type>boolean</type></entry>
<entry>does current user have privilege for foreign server</entry>
</row>
<row>
<entry><literal><function>has_table_privilege</function>(<parameter>user</parameter>,
<parameter>table</parameter>,
......@@ -11435,12 +11465,18 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
<indexterm>
<primary>has_function_privilege</primary>
</indexterm>
<indexterm>
<primary>has_foreign_data_wrapper_privilege</primary>
</indexterm>
<indexterm>
<primary>has_language_privilege</primary>
</indexterm>
<indexterm>
<primary>has_schema_privilege</primary>
</indexterm>
<indexterm>
<primary>has_server_privilege</primary>
</indexterm>
<indexterm>
<primary>has_table_privilege</primary>
</indexterm>
......@@ -11478,6 +11514,14 @@ SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
</programlisting>
</para>
<para>
<function>has_foreign_data_wrapper_privilege</function> checks whether a user
can access a foreign-data wrapper in a particular way. The possibilities for its
arguments are analogous to <function>has_table_privilege</function>.
The desired access privilege type must evaluate to
<literal>USAGE</literal>.
</para>
<para>
<function>has_language_privilege</function> checks whether a user
can access a procedural language in a particular way. The possibilities
......@@ -11495,6 +11539,14 @@ SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
<literal>USAGE</literal>.
</para>
<para>
<function>has_server_privilege</function> checks whether a user
can access a foreign server in a particular way. The possibilities for its
arguments are analogous to <function>has_table_privilege</function>.
The desired access privilege type must evaluate to
<literal>USAGE</literal>.
</para>
<para>
<function>has_table_privilege</function> checks whether a user
can access a table in a particular way. The user can be
......
This diff is collapsed.
<!-- $PostgreSQL: pgsql/doc/src/sgml/keywords.sgml,v 2.21 2008/12/03 12:39:57 petere Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/keywords.sgml,v 2.22 2008/12/19 16:25:16 petere Exp $ -->
<appendix id="sql-keywords-appendix">
<title><acronym>SQL</acronym> Key Words</title>
......@@ -2687,6 +2687,14 @@
<entry>reserved</entry>
<entry>reserved</entry>
</row>
<row>
<entry><token>LIBRARY</token></entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry><token>LIKE</token></entry>
<entry>reserved (can be function or type)</entry>
......@@ -2818,8 +2826,8 @@
<row>
<entry><token>MAPPING</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
......@@ -3441,7 +3449,7 @@
</row>
<row>
<entry><token>OPTIONS</token></entry>
<entry></entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
......@@ -4455,6 +4463,14 @@
<entry>non-reserved</entry>
<entry>non-reserved</entry>
</row>
<row>
<entry><token>SERVER</token></entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry><token>SERVER_NAME</token></entry>
<entry></entry>
......@@ -5583,6 +5599,14 @@
<entry>reserved</entry>
<entry>reserved</entry>
</row>
<row>
<entry><token>WRAPPER</token></entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry><token>WRITE</token></entry>
<entry>non-reserved</entry>
......
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.73 2008/03/27 17:24:16 momjian Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.74 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
Complete list of usable sgml source files in this directory.
-->
......@@ -10,6 +10,7 @@ Complete list of usable sgml source files in this directory.
<!entity alterConversion system "alter_conversion.sgml">
<!entity alterDatabase system "alter_database.sgml">
<!entity alterDomain system "alter_domain.sgml">
<!entity alterForeignDataWrapper system "alter_foreign_data_wrapper.sgml">
<!entity alterFunction system "alter_function.sgml">
<!entity alterGroup system "alter_group.sgml">
<!entity alterIndex system "alter_index.sgml">
......@@ -19,6 +20,7 @@ Complete list of usable sgml source files in this directory.
<!entity alterOperatorFamily system "alter_opfamily.sgml">
<!entity alterRole system "alter_role.sgml">
<!entity alterSchema system "alter_schema.sgml">
<!entity alterServer system "alter_server.sgml">
<!entity alterSequence system "alter_sequence.sgml">
<!entity alterTable system "alter_table.sgml">
<!entity alterTableSpace system "alter_tablespace.sgml">
......@@ -29,6 +31,7 @@ Complete list of usable sgml source files in this directory.
<!entity alterTrigger system "alter_trigger.sgml">
<!entity alterType system "alter_type.sgml">
<!entity alterUser system "alter_user.sgml">
<!entity alterUserMapping system "alter_user_mapping.sgml">
<!entity alterView system "alter_view.sgml">
<!entity analyze system "analyze.sgml">
<!entity begin system "begin.sgml">
......@@ -45,6 +48,7 @@ Complete list of usable sgml source files in this directory.
<!entity createConversion system "create_conversion.sgml">
<!entity createDatabase system "create_database.sgml">
<!entity createDomain system "create_domain.sgml">
<!entity createForeignDataWrapper system "create_foreign_data_wrapper.sgml">
<!entity createFunction system "create_function.sgml">
<!entity createGroup system "create_group.sgml">
<!entity createIndex system "create_index.sgml">
......@@ -56,6 +60,7 @@ Complete list of usable sgml source files in this directory.
<!entity createRule system "create_rule.sgml">
<!entity createSchema system "create_schema.sgml">
<!entity createSequence system "create_sequence.sgml">
<!entity createServer system "create_server.sgml">
<!entity createTable system "create_table.sgml">
<!entity createTableAs system "create_table_as.sgml">
<!entity createTableSpace system "create_tablespace.sgml">
......@@ -66,6 +71,7 @@ Complete list of usable sgml source files in this directory.
<!entity createTSTemplate system "create_tstemplate.sgml">
<!entity createType system "create_type.sgml">
<!entity createUser system "create_user.sgml">
<!entity createUserMapping system "create_user_mapping.sgml">
<!entity createView system "create_view.sgml">
<!entity deallocate system "deallocate.sgml">
<!entity declare system "declare.sgml">
......@@ -76,6 +82,7 @@ Complete list of usable sgml source files in this directory.
<!entity dropConversion system "drop_conversion.sgml">
<!entity dropDatabase system "drop_database.sgml">
<!entity dropDomain system "drop_domain.sgml">
<!entity dropForeignDataWrapper system "drop_foreign_data_wrapper.sgml">
<!entity dropFunction system "drop_function.sgml">
<!entity dropGroup system "drop_group.sgml">
<!entity dropIndex system "drop_index.sgml">
......@@ -88,6 +95,7 @@ Complete list of usable sgml source files in this directory.
<!entity dropRule system "drop_rule.sgml">
<!entity dropSchema system "drop_schema.sgml">
<!entity dropSequence system "drop_sequence.sgml">
<!entity dropServer system "drop_server.sgml">
<!entity dropTable system "drop_table.sgml">
<!entity dropTableSpace system "drop_tablespace.sgml">
<!entity dropTrigger system "drop_trigger.sgml">
......@@ -97,6 +105,7 @@ Complete list of usable sgml source files in this directory.
<!entity dropTSTemplate system "drop_tstemplate.sgml">
<!entity dropType system "drop_type.sgml">
<!entity dropUser system "drop_user.sgml">
<!entity dropUserMapping system "drop_user_mapping.sgml">
<!entity dropView system "drop_view.sgml">
<!entity end system "end.sgml">
<!entity execute system "execute.sgml">
......
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_foreign_data_wrapper.sgml,v 1.1 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-ALTERFOREIGNDATAWRAPPER">
<refmeta>
<refentrytitle id="sql-alterforeigndatawrapper-title">ALTER FOREIGN DATA WRAPPER</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>ALTER FOREIGN DATA WRAPPER</refname>
<refpurpose>change the definition of a foreign-data wrapper</refpurpose>
</refnamediv>
<indexterm zone="sql-alterforeigndatawrapper">
<primary>ALTER FOREIGN DATA WRAPPER</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable>
[ LIBRARY '<replaceable class="parameter">libraryname</replaceable>' ]
[ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ]) ]
ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> OWNER TO <replaceable>new_owner</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>ALTER FOREIGN DATA WRAPPER</command> changes the
definition of a foreign-data wrapper. The first form of the
command changes the library or the generic options of the
foreign-data wrapper (at least one clause is required). The second
form changes the owner of the foreign-data wrapper.
</para>
<para>
Only superusers can alter foreign-data wrappers. Additionally,
only superusers can own foreign-data wrappers.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
The name of an existing foreign-data wrapper.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">libraryname</replaceable></term>
<listitem>
<para>
New name of the foreign-data wrapper library.
</para>
<para>
Note that it is possible that after changing the library, the
options to the foreign-data wrapper, servers, and user mappings
have become invalid. It is up to the user to make sure that
these options are correct before using the foreign-data
wrapper.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )</literal></term>
<listitem>
<para>
Change options for the foreign-data
wrapper. <literal>ADD</>, <literal>SET</>, and <literal>DROP</>
specify the action to be performed. <literal>ADD</> is assumed
if no operation is explicitly specified. Option names must be
unique; names and values are also validated using the foreign
data wrapper library.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Change a foreign-data wrapper <literal>dbi</>, add
option <literal>foo</>, drop <literal>bar</>:
<programlisting>
ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP 'bar');
</programlisting>
</para>
<para>
Change the foreign-data wrapper <literal>dbi</> library
to <literal>/home/bob/mylibrary.so</>:
<programlisting>
ALTER FOREIGN DATA WRAPPER dbi LIBRARY '/home/bob/mylibrary.so';
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>ALTER FOREIGN DATA WRAPPER</command> conforms to ISO/IEC
9075-9 (SQL/MED). The standard does not specify the <literal>OWNER
TO</> variant of the command.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createforeigndatawrapper" endterm="sql-createforeigndatawrapper-title"></member>
<member><xref linkend="sql-dropforeigndatawrapper" endterm="sql-dropforeigndatawrapper-title"></member>
</simplelist>
</refsect1>
</refentry>
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_server.sgml,v 1.1 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-ALTERSERVER">
<refmeta>
<refentrytitle id="sql-alterserver-title">ALTER SERVER</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>ALTER SERVER</refname>
<refpurpose>change the definition of a foreign server</refpurpose>
</refnamediv>
<indexterm zone="sql-alterserver">
<primary>ALTER SERVER</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
ALTER SERVER <replaceable class="parameter">servername</replaceable> [ VERSION 'newversion' ]
[ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] ) ]
ALTER SERVER <replaceable class="PARAMETER">servername</replaceable> OWNER TO <replaceable>new_owner</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>ALTER SERVER</command> changes the definition of a foreign
server. The first form changes the server version string or the
generic options of the server (at least one clause is required).
The second form changes the owner of the server.
</para>
<para>
To alter the server you must be the owner of the server.
Additionally to alter the owner, you must own the server and also
be a direct or indirect member of the new owning role, and you must
have <literal>USAGE</> privilege on the server's foreign-data
wrapper. (Note that superusers satisfy all these criteria
automatically.)
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">servername</replaceable></term>
<listitem>
<para>
The name of an existing server.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">serverversion</replaceable></term>
<listitem>
<para>
New server version.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )</literal></term>
<listitem>
<para>
Change options for the
server. <literal>ADD</>, <literal>SET</>, and <literal>DROP</>
specify the action to be performed. <literal>ADD</> is assumed
if no operation is explicitly specified. Option names must be
unique; names and values are also validated using the server's
foreign-data wrapper library.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Alter server <literal>foo</>, add connection options:
<programlisting>
ALTER SERVER foo OPTIONS (host 'foo', dbname 'foodb');
</programlisting>
</para>
<para>
Alter server <literal>foo</>, change version,
change <literal>host</> option:
<programlisting>
ALTER SERVER foo VERSION '8.4' OPTIONS (SET host 'baz');
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>ALTER SERVER</command> conforms to ISO/IEC 9075-9 (SQL/MED).
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createserver" endterm="sql-createserver-title"></member>
<member><xref linkend="sql-dropserver" endterm="sql-dropserver-title"></member>
</simplelist>
</refsect1>
</refentry>
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_user_mapping.sgml,v 1.1 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-ALTERUSERMAPPING">
<refmeta>
<refentrytitle id="sql-alterusermapping-title">ALTER USER MAPPING</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>ALTER USER MAPPING</refname>
<refpurpose>change the definition of a user mapping</refpurpose>
</refnamediv>
<indexterm zone="sql-alterusermapping">
<primary>ALTER USER MAPPING</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
ALTER USER MAPPING FOR { <replaceable class="parameter">username</replaceable> | USER | CURRENT_USER | PUBLIC }
SERVER <replaceable class="parameter">servername</replaceable>
OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>ALTER USER MAPPING</command> changes the definition of a
user mapping. Only the owner of the server can change the user
mappings of that server.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">username</replaceable></term>
<listitem>
<para>
User name of the mapping. <literal>CURRENT_USER</>
and <literal>USER</> match the name of the current
user. <literal>PUBLIC</> is used to match all present and future
user names in the system.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">servername</replaceable></term>
<listitem>
<para>
Server name of the user mapping.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )</literal></term>
<listitem>
<para>
Change options for the user mapping. The new options override
any previously specified
options. <literal>ADD</>, <literal>SET</>, and <literal>DROP</>
specify the action to be performed. <literal>ADD</> is assumed
if no operation is explicitly specified. Option names must be
unique; options are also validated by the server's foreign-data
wrapper.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Change the password for user mapping <literal>bob</>, server<literal> foo</>:
<programlisting>
ALTER USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'public');
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>ALTER USER MAPPING</command> conforms to ISO/IEC 9075-9
(SQL/MED). There is a subtle syntax issue: The standard omits
the <literal>FOR</literal> key word. Since both <literal>CREATE
USER MAPPING</literal> and <literal>DROP USER MAPPING</literal> use
<literal>FOR</literal> in analogous positions, and IBM DB2 (being
the other major SQL/MED implementation) also requires it
for <literal>ALTER USER MAPPING</literal>, PostgreSQL diverges from
the standard here in the interest of consistency and
interoperability.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createusermapping" endterm="sql-createusermapping-title"></member>
<member><xref linkend="sql-dropusermapping" endterm="sql-dropusermapping-title"></member>
</simplelist>
</refsect1>
</refentry>
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_foreign_data_wrapper.sgml,v 1.1 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-CREATEFOREIGNDATAWRAPPER">
<refmeta>
<refentrytitle id="sql-createforeigndatawrapper-title">CREATE FOREIGN DATA WRAPPER</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>CREATE FOREIGN DATA WRAPPER</refname>
<refpurpose>define a new foreign-data wrapper</refpurpose>
</refnamediv>
<indexterm zone="sql-createforeigndatawrapper">
<primary>CREATE FOREIGN DATA WRAPPER</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
CREATE FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable>
LIBRARY '<replaceable class="parameter">libraryname</replaceable>'
LANGUAGE C
[ OPTIONS ( <replaceable class="PARAMETER">option</replaceable> '<replaceable class="PARAMETER">value</replaceable>' [, ... ] ) ]
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>CREATE FOREIGN DATA WRAPPER</command> creates a new
foreign-data wrapper. The user who defines a foreign-data wrapper
becomes its owner.
</para>
<para>
The foreign-data wrapper name must be unique within the database.
</para>
<para>
Only superusers can create foreign-data wrappers.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
The name of the foreign-data wrapper to be created.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">libraryname</replaceable></term>
<listitem>
<para>
The name of the shared library implementing the foreign-data
wrapper. The file name is specified in the same way as for
shared library names in <xref linkend="sql-createfunction"
endterm="sql-createfunction-title">; in particular, one can rely
on a search path and automatic addition of the system's standard
shared library file name extension.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>LANGUAGE C</literal></term>
<listitem>
<para>
Currently, only the C programming language is supported for
implementing foreign-data wrappers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>OPTIONS ( <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )</literal></term>
<listitem>
<para>
This clause specifies options for the new foreign-data wrapper.
The allowed option names and values are specific to each foreign
data wrapper and are validated using the foreign-data wrapper
library. Option names must be unique.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Notes</title>
<para>
At the moment, the foreign-data wrapper functionality is very
rudimentary. The purpose of foreign-data wrappers, foreign
servers, and user mappings is to store this information in a
standard way so that it can be queried by interested applications.
The functionality to actually query external data does not exist
yet.
</para>
<para>
The C language API for foreign-data wrappers is currently not
documented, stable, or complete. Would-be authors of functionality
interfacing with the SQL/MED functionality are advised to contact
the PostgreSQL developers.
</para>
<para>
There are currently two foreign-data wrapper libraries
provided: <filename>dummy_fdw</filename>, which does nothing and
could be useful for testing,
and <filename>postgresql_fdw</filename>, which accepts options
corresponding to <application>libpq</> connection parameters.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Create a foreign-data wrapper <literal>dummy</> with
library <literal>dummy_fdw</>:
<programlisting>
CREATE FOREIGN DATA WRAPPER dummy LIBRARY 'dummy_fdw' LANGUAGE C;
</programlisting>
</para>
<para>
Create a foreign-data wrapper <literal>postgresql</> with
library <literal>postgresql_fdw</>:
<programlisting>
CREATE FOREIGN DATA WRAPPER postgresql LIBRARY 'postgresql_fdw' LANGUAGE C;
</programlisting>
</para>
<para>
Create a foreign-data wrapper <literal>mywrapper</> with library
<literal>/home/bob/mywrapper.so</> and some options:
<programlisting>
CREATE FOREIGN DATA WRAPPER mywrapper
LIBRARY '/home/bob/mywrapper.so'
LANGUAGE C
OPTIONS (debug 'true');
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>CREATE FOREIGN DATA WRAPPER</command> conforms to ISO/IEC
9075-9 (SQL/MED), with the exception that
the <literal>LIBRARY</literal> clause is not optional in
PostgreSQL.
</para>
<para>
Note, however, that the SQL/MED functionality as a whole is not yet
conforming.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-alterforeigndatawrapper" endterm="sql-alterforeigndatawrapper-title"></member>
<member><xref linkend="sql-dropforeigndatawrapper" endterm="sql-dropforeigndatawrapper-title"></member>
<member><xref linkend="sql-createserver" endterm="sql-createserver-title"></member>
<member><xref linkend="sql-createusermapping" endterm="sql-createusermapping-title"></member>
</simplelist>
</refsect1>
</refentry>
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_server.sgml,v 1.1 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-CREATESERVER">
<refmeta>
<refentrytitle id="sql-createserver-title">CREATE SERVER</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>CREATE SERVER</refname>
<refpurpose>define a new foreign server</refpurpose>
</refnamediv>
<indexterm zone="sql-createserver">
<primary>CREATE SERVER</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
CREATE SERVER <replaceable class="parameter">servername</replaceable> [ TYPE 'servertype' ] [ VERSION 'serverversion' ]
FOREIGN DATA WRAPPER <replaceable class="parameter">fdwname</replaceable>
[ OPTIONS ( <replaceable class="PARAMETER">option</replaceable> '<replaceable class="PARAMETER">value</replaceable>' [, ... ] ) ]
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>CREATE SERVER</command> defines a new foreign server. The
user who defines the server becomes its owner.
</para>
<para>
The server name must be unique within database.
</para>
<para>
Creating a server requires <literal>USAGE</> privilege on the
foreign-data wrapper being used.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">servername</replaceable></term>
<listitem>
<para>
The name of the foreign server to be created.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">servertype</replaceable></term>
<listitem>
<para>
Optional server type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">serverversion</replaceable></term>
<listitem>
<para>
Optional server version.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">fdwname</replaceable></term>
<listitem>
<para>
The name of the foreign-data wrapper that manages the server.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>OPTIONS ( <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )</literal></term>
<listitem>
<para>
This clause specifies the options for the server. The options
typically define the connection details of the server, but the
actual names and values are dependent on the server's
foreign-data wrapper.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Create a server <literal>foo</> that uses the built-in foreign-data
wrapper <literal>default</>:
<programlisting>
CREATE SERVER foo FOREIGN DATA WRAPPER "default";
</programlisting>
</para>
<para>
Create a server <literal>myserver</> that uses the
foreign-data wrapper <literal>pgsql</>:
<programlisting>
CREATE SERVER myserver FOREIGN DATA WRAPPER pgsql OPTIONS (host 'foo', dbname 'foodb', port '5432');
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>CREATE SERVER</command> conforms to ISO/IEC 9075-9 (SQL/MED).
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-alterserver" endterm="sql-alterserver-title"></member>
<member><xref linkend="sql-dropserver" endterm="sql-dropserver-title"></member>
<member><xref linkend="sql-createforeigndatawrapper" endterm="sql-createforeigndatawrapper-title"></member>
<member><xref linkend="sql-createusermapping" endterm="sql-createusermapping-title"></member>
</simplelist>
</refsect1>
</refentry>
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_user_mapping.sgml,v 1.1 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-CREATEUSERMAPPING">
<refmeta>
<refentrytitle id="sql-createusermapping-title">CREATE USER MAPPING</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>CREATE USER MAPPING</refname>
<refpurpose>define a new mapping of a user to a foreign server</refpurpose>
</refnamediv>
<indexterm zone="sql-createusermapping">
<primary>CREATE USER MAPPING</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
CREATE USER MAPPING FOR { <replaceable class="parameter">username</replaceable> | USER | CURRENT_USER | PUBLIC }
SERVER <replaceable class="parameter">servername</replaceable>
[ OPTIONS ( <replaceable class="PARAMETER">option</replaceable> '<replaceable class="PARAMETER">value</replaceable>' [ , ... ] ) ]
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>CREATE USER MAPPING</command> defines a mapping of a user
to a foreign server. You must be the owner of the server to define
user mappings for it.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">username</replaceable></term>
<listitem>
<para>
The name of an existing user that is mapped to foreign server.
<literal>CURRENT_USER</> and <literal>USER</> match the name of
the current user. <literal>PUBLIC</> is used to match all
present and future user names in the system.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">servername</replaceable></term>
<listitem>
<para>
The name of an existing server for which the user mapping is
to be created.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>OPTIONS ( <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )</literal></term>
<listitem>
<para>
This clause specifies the options of the user mapping. The
options typically define the actual user name and password of
the mapping. Option names must be unque. The allowed option
names and values are specific to the server's foreign-data wrapper.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Create a user mapping for user <literal>bob</>, server <literal>foo</>:
<programlisting>
CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'secret');
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>CREATE USER MAPPING</command> conforms to ISO/IEC 9075-9 (SQL/MED).
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-alterusermapping" endterm="sql-alterusermapping-title"></member>
<member><xref linkend="sql-dropusermapping" endterm="sql-dropusermapping-title"></member>
<member><xref linkend="sql-createforeigndatawrapper" endterm="sql-createforeigndatawrapper-title"></member>
<member><xref linkend="sql-createserver" endterm="sql-createserver-title"></member>
</simplelist>
</refsect1>
</refentry>
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_foreign_data_wrapper.sgml,v 1.1 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-DROPFOREIGNDATAWRAPPER">
<refmeta>
<refentrytitle id="sql-dropforeigndatawrapper-title">DROP FOREIGN DATA WRAPPER</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>DROP FOREIGN DATA WRAPPER</refname>
<refpurpose>remove a foreign-data wrapper</refpurpose>
</refnamediv>
<indexterm zone="sql-dropforeigndatawrapper">
<primary>DROP FOREIGN DATA WRAPPER</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
DROP FOREIGN DATA WRAPPER [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [ CASCADE | RESTRICT ]
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>DROP FOREIGN DATA WRAPPER</command> removes an existing
foreign-data wrapper. To execute this command, the current user
must be the owner of the foreign-data wrapper.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><literal>IF EXISTS</literal></term>
<listitem>
<para>
Do not throw an error if the foreign-data wrapper does not
exist. A notice is issued in this case.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
The name of an existing foreign-data wrapper.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>CASCADE</literal></term>
<listitem>
<para>
Automatically drop objects that depend on the foreign-data
wrapper (such as servers).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>RESTRICT</literal></term>
<listitem>
<para>
Refuse to drop the foreign-data wrappers if any objects depend
on it. This is the default.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Drop the foreign-data wrapper <literal>dbi</>:
<programlisting>
DROP FOREIGN DATA WRAPPER dbi;
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>DROP FOREIGN DATA WRAPPER</command> conforms to ISO/IEC
9075-9 (SQL/MED). The <literal>IF EXISTS</> clause is
a <productname>PostgreSQL</> extension.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createforeigndatawrapper" endterm="sql-createforeigndatawrapper-title"></member>
<member><xref linkend="sql-alterforeigndatawrapper" endterm="sql-alterforeigndatawrapper-title"></member>
</simplelist>
</refsect1>
</refentry>
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_server.sgml,v 1.1 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-DROPSERVER">
<refmeta>
<refentrytitle id="sql-dropserver-title">DROP SERVER</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>DROP SERVER</refname>
<refpurpose>remove a foreign server descriptor</refpurpose>
</refnamediv>
<indexterm zone="sql-dropserver">
<primary>DROP SERVER</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
DROP SERVER [ IF EXISTS ] <replaceable class="parameter">servername</replaceable> [ CASCADE | RESTRICT ]
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>DROP SERVER</command> removes an existing foreign server
descriptor. To execute this command, the current user must be the
owner of the server.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><literal>IF EXISTS</literal></term>
<listitem>
<para>
Do not throw an error if the server does not exist. A notice is
issued in this case.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">servername</replaceable></term>
<listitem>
<para>
The name of an existing server.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>CASCADE</literal></term>
<listitem>
<para>
Automatically drop objects that depend on the server (such as
user mappings).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>RESTRICT</literal></term>
<listitem>
<para>
Refuse to drop the server if any objects depend on it. This is
the default.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Drop a server <literal>foo</> if it exists:
<programlisting>
DROP SERVER IF EXISTS foo;
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>DROP SERVER</command> conforms to ISO/IEC 9075-9
(SQL/MED). The <literal>IF EXISTS</> clause is
a <productname>PostgreSQL</> extension.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createserver" endterm="sql-createserver-title"></member>
<member><xref linkend="sql-alterserver" endterm="sql-alterserver-title"></member>
</simplelist>
</refsect1>
</refentry>
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_user_mapping.sgml,v 1.1 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-DROPUSERMAPPING">
<refmeta>
<refentrytitle id="sql-dropusermapping-title">DROP USER MAPPING</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>DROP USER MAPPING</refname>
<refpurpose>remove a user mapping for a foreign server</refpurpose>
</refnamediv>
<indexterm zone="sql-dropusermapping">
<primary>DROP USER MAPPING</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
DROP USER MAPPING [ IF EXISTS ] FOR { <replaceable class="parameter">username</replaceable> | USER | CURRENT_USER | PUBLIC } SERVER <replaceable class="parameter">servername</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>DROP USER MAPPING</command> removes an existing user
mapping from foreign server. To execute this command, the current
user must be the owner of the server containing the mapping.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><literal>IF EXISTS</literal></term>
<listitem>
<para>
Do not throw an error if the user mapping does not exist. A
notice is issued in this case.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">username</replaceable></term>
<listitem>
<para>
User name of the mapping. <literal>CURRENT_USER</>
and <literal>USER</> match the name of the current
user. <literal>PUBLIC</> is used to match all present and
future user names in the system.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">servername</replaceable></term>
<listitem>
<para>
Server name of the user mapping.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Drop a user mapping <literal>bob</>, server <literal>foo</> if it exists:
<programlisting>
DROP USER MAPPING IF EXISTS FOR bob SERVER foo;
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>DROP USER MAPPING</command> conforms to ISO/IEC 9075-9
(SQL/MED). The <literal>IF EXISTS</> clause is
a <productname>PostgreSQL</> extension.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createusermapping" endterm="sql-createusermapping-title"></member>
<member><xref linkend="sql-alterusermapping" endterm="sql-alterusermapping-title"></member>
</simplelist>
</refsect1>
</refentry>
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.72 2008/11/14 10:22:47 petere Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.73 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
......@@ -35,6 +35,14 @@ GRANT { { CREATE | CONNECT | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }
ON DATABASE <replaceable>dbname</replaceable> [, ...]
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { USAGE | ALL [ PRIVILEGES ] }
ON FOREIGN DATA WRAPPER <replaceable>fdwname</> [, ...]
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { USAGE | ALL [ PRIVILEGES ] }
ON FOREIGN SERVER <replaceable>servername</> [, ...]
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
GRANT { EXECUTE | ALL [ PRIVILEGES ] }
ON FUNCTION <replaceable>funcname</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) [, ...]
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
......@@ -61,10 +69,10 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
<para>
The <command>GRANT</command> command has two basic variants: one
that grants privileges on a database object (table, view, sequence,
database, function, procedural language, schema, or tablespace),
and one that grants membership in a role. These variants are
similar in many ways, but they are different enough to be described
separately.
database, foreign-data wrapper, foreign server, function,
procedural language, schema, or tablespace), and one that grants
membership in a role. These variants are similar in many ways, but
they are different enough to be described separately.
</para>
<para>
......@@ -299,6 +307,14 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
For sequences, this privilege allows the use of the
<function>currval</function> and <function>nextval</function> functions.
</para>
<para>
For foreign-data wrappers, this privilege enables the grantee
to create new servers using that foreign-data wrapper.
</para>
<para>
For servers, this privilege enables the grantee to query the
options of the server and associated user mappings.
</para>
</listitem>
</varlistentry>
......
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.213 2008/12/01 09:20:37 petere Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.214 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
......@@ -946,6 +946,64 @@ testdb=&gt;
</varlistentry>
<varlistentry>
<term><literal>\des [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
<term><literal>\des+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
<listitem>
<para>
Lists all foreign servers (mnemonic: <quote>external
servers</quote>).
If <replaceable class="parameter">pattern</replaceable> is
specified, only those servers whose name matches the pattern
are listed. If the form <literal>\des+</literal> is used, a
full desription of each server is shown, including the
server's ACL, type, version, and options.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>\deu [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
<term><literal>\deu+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
<listitem>
<para>
Lists all user mappings (mnemonic: <quote>external
users</quote>).
If <replaceable class="parameter">pattern</replaceable> is
specified, only those mappings whose user names match the
pattern are listed. If the form <literal>\deu+</literal> is
used, additional information about each mapping is shown.
</para>
<caution>
<para>
<literal>\deu+</literal> might also display the user name and
password of the remote user, so care should be taken not to
disclose them.
</para>
</caution>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>\dew [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
<term><literal>\dew+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
<listitem>
<para>
Lists all foreign-data wrappers (mnemonic: <quote>external
wrappers</quote>).
If <replaceable class="parameter">pattern</replaceable> is
specified, only those foreign-data wrappers whose name matches
the pattern are listed. If the form <literal>\dew+</literal>
is used, the ACL and options of the foreign-data wrapper are
also shown.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>\df [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
<term><literal>\df+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>
......
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.49 2008/11/14 10:22:47 petere Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.50 2008/12/19 16:25:16 petere Exp $
PostgreSQL documentation
-->
......@@ -41,6 +41,18 @@ REVOKE [ GRANT OPTION FOR ]
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
[ CASCADE | RESTRICT ]
REVOKE [ GRANT OPTION FOR ]
{ USAGE | ALL [ PRIVILEGES ] }
ON FOREIGN DATA WRAPPER <replaceable>fdwname</replaceable> [, ...]
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
[ CASCADE | RESTRICT ]
REVOKE [ GRANT OPTION FOR ]
{ USAGE | ALL [ PRIVILEGES ] }
ON FOREIGN SERVER <replaceable>servername</replaceable> [, ...]
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
[ CASCADE | RESTRICT ]
REVOKE [ GRANT OPTION FOR ]
{ EXECUTE | ALL [ PRIVILEGES ] }
ON FUNCTION <replaceable>funcname</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) [, ...]
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/reference.sgml,v 1.66 2008/03/27 17:24:16 momjian Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/reference.sgml,v 1.67 2008/12/19 16:25:16 petere Exp $ -->
<part id="reference">
<title>Reference</title>
......@@ -38,6 +38,7 @@
&alterConversion;
&alterDatabase;
&alterDomain;
&alterForeignDataWrapper;
&alterFunction;
&alterGroup;
&alterIndex;
......@@ -48,6 +49,7 @@
&alterRole;
&alterSchema;
&alterSequence;
&alterServer;
&alterTable;
&alterTableSpace;
&alterTSConfig;
......@@ -57,6 +59,7 @@
&alterTrigger;
&alterType;
&alterUser;
&alterUserMapping;
&alterView;
&analyze;
&begin;
......@@ -73,6 +76,7 @@
&createConversion;
&createDatabase;
&createDomain;
&createForeignDataWrapper;
&createFunction;
&createGroup;
&createIndex;
......@@ -84,6 +88,7 @@
&createRule;
&createSchema;
&createSequence;
&createServer;
&createTable;
&createTableAs;
&createTableSpace;
......@@ -94,6 +99,7 @@
&createTrigger;
&createType;
&createUser;
&createUserMapping;
&createView;
&deallocate;
&declare;
......@@ -104,6 +110,7 @@
&dropConversion;
&dropDatabase;
&dropDomain;
&dropForeignDataWrapper;
&dropFunction;
&dropGroup;
&dropIndex;
......@@ -116,6 +123,7 @@
&dropRule;
&dropSchema;
&dropSequence;
&dropServer;
&dropTable;
&dropTableSpace;
&dropTSConfig;
......@@ -125,6 +133,7 @@
&dropTrigger;
&dropType;
&dropUser;
&dropUserMapping;
&dropView;
&end;
&execute;
......
......@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/Makefile,v 1.43 2008/03/18 16:24:50 petere Exp $
# $PostgreSQL: pgsql/src/Makefile,v 1.44 2008/12/19 16:25:16 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -19,6 +19,7 @@ all install installdirs uninstall distprep:
$(MAKE) -C backend $@
$(MAKE) -C backend/utils/mb/conversion_procs $@
$(MAKE) -C backend/snowball $@
$(MAKE) -C backend/foreign $@-fdw
$(MAKE) -C include $@
$(MAKE) -C interfaces $@
$(MAKE) -C bin $@
......
......@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/backend/Makefile,v 1.130 2008/08/29 13:02:32 petere Exp $
# $PostgreSQL: pgsql/src/backend/Makefile,v 1.131 2008/12/19 16:25:16 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -14,7 +14,7 @@ subdir = src/backend
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
SUBDIRS = access bootstrap catalog parser commands executor lib libpq \
SUBDIRS = access bootstrap catalog parser commands executor foreign lib libpq \
main nodes optimizer port postmaster regex rewrite \
storage tcop tsearch utils $(top_builddir)/src/timezone
......
......@@ -2,7 +2,7 @@
#
# Makefile for backend/catalog
#
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.67 2008/11/19 10:34:51 heikki Exp $
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.68 2008/12/19 16:25:16 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -36,6 +36,7 @@ POSTGRES_BKI_SRCS = $(addprefix $(top_srcdir)/src/include/catalog/,\
pg_authid.h pg_auth_members.h pg_shdepend.h pg_shdescription.h \
pg_ts_config.h pg_ts_config_map.h pg_ts_dict.h \
pg_ts_parser.h pg_ts_template.h \
pg_foreign_data_wrapper.h pg_foreign_server.h pg_user_mapping.h \
toasting.h indexing.h \
)
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.82 2008/11/10 21:49:16 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.83 2008/12/19 16:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -33,6 +33,8 @@
#include "catalog/pg_conversion_fn.h"
#include "catalog/pg_database.h"
#include "catalog/pg_depend.h"
#include "catalog/pg_foreign_data_wrapper.h"
#include "catalog/pg_foreign_server.h"
#include "catalog/pg_language.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_opclass.h"
......@@ -47,6 +49,7 @@
#include "catalog/pg_ts_parser.h"
#include "catalog/pg_ts_template.h"
#include "catalog/pg_type.h"
#include "catalog/pg_user_mapping.h"
#include "commands/comment.h"
#include "commands/dbcommands.h"
#include "commands/defrem.h"
......@@ -55,6 +58,7 @@
#include "commands/tablespace.h"
#include "commands/trigger.h"
#include "commands/typecmds.h"
#include "foreign/foreign.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
#include "parser/parsetree.h"
......@@ -1105,6 +1109,18 @@ doDeletion(const ObjectAddress *object)
RemoveTSConfigurationById(object->objectId);
break;
case OCLASS_USER_MAPPING:
RemoveUserMappingById(object->objectId);
break;
case OCLASS_FOREIGN_SERVER:
RemoveForeignServerById(object->objectId);
break;
case OCLASS_FDW:
RemoveForeignDataWrapperById(object->objectId);
break;
/* OCLASS_ROLE, OCLASS_DATABASE, OCLASS_TBLSPACE not handled */
default:
......@@ -2005,6 +2021,18 @@ getObjectClass(const ObjectAddress *object)
case TableSpaceRelationId:
Assert(object->objectSubId == 0);
return OCLASS_TBLSPACE;
case ForeignDataWrapperRelationId:
Assert(object->objectSubId == 0);
return OCLASS_FDW;
case ForeignServerRelationId:
Assert(object->objectSubId == 0);
return OCLASS_FOREIGN_SERVER;
case UserMappingRelationId:
Assert(object->objectSubId == 0);
return OCLASS_USER_MAPPING;
}
/* shouldn't get here */
......@@ -2501,6 +2529,50 @@ getObjectDescription(const ObjectAddress *object)
break;
}
case OCLASS_FDW:
{
ForeignDataWrapper *fdw;
fdw = GetForeignDataWrapper(object->objectId);
appendStringInfo(&buffer, _("foreign-data wrapper %s"), fdw->fdwname);
break;
}
case OCLASS_FOREIGN_SERVER:
{
ForeignServer *srv;
srv = GetForeignServer(object->objectId);
appendStringInfo(&buffer, _("server %s"), srv->servername);
break;
}
case OCLASS_USER_MAPPING:
{
HeapTuple tup;
Oid useid;
char *usename;
tup = SearchSysCache(USERMAPPINGOID,
ObjectIdGetDatum(object->objectId),
0, 0, 0);
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for user mapping %u",
object->objectId);
useid = ((Form_pg_user_mapping) GETSTRUCT(tup))->umuser;
ReleaseSysCache(tup);
if (OidIsValid(useid))
usename = GetUserNameFromId(useid);
else
usename = "public";
appendStringInfo(&buffer, _("user mapping for %s"), usename);
break;
}
default:
appendStringInfo(&buffer, "unrecognized object %u %u %d",
object->classId,
......
This diff is collapsed.
......@@ -487,6 +487,31 @@ T652 SQL-dynamic statements in SQL routines NO
T653 SQL-schema statements in external routines NO
T654 SQL-dynamic statements in external routines NO
T655 Cyclically dependent routines NO
M001 Datalinks NO
M002 Datalinks via SQL/CLI NO
M003 Datalinks via Embedded SQL NO
M004 Foreign data support NO
M005 Foreign schema support NO
M006 GetSQLString routine NO
M007 TransmitRequest NO
M009 GetOpts and GetStatistics routines NO
M010 Foreign data wrapper support NO
M011 Datalinks via Ada NO
M012 Datalinks via C NO
M013 Datalinks via COBOL NO
M014 Datalinks via Fortran NO
M015 Datalinks via M NO
M016 Datalinks via Pascal NO
M017 Datalinks via PL/I NO
M018 Foreign data wrapper interface routines in Ada NO
M019 Foreign data wrapper interface routines in C NO
M020 Foreign data wrapper interface routines in COBOL NO
M021 Foreign data wrapper interface routines in Fortran NO
M022 Foreign data wrapper interface routines in MUMPS NO
M023 Foreign data wrapper interface routines in Pascal NO
M024 Foreign data wrapper interface routines in PL/I NO
M030 SQL-server foreign data support NO
M031 Foreign data wrapper general routines NO
X010 XML type YES
X011 Arrays of XML type YES
X012 Multisets of XML type NO
......
......@@ -3,7 +3,7 @@
*
* Copyright (c) 1996-2008, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.56 2008/11/09 21:24:32 tgl Exp $
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.57 2008/12/19 16:25:17 petere Exp $
*/
CREATE VIEW pg_roles AS
......@@ -381,6 +381,28 @@ CREATE VIEW pg_stat_bgwriter AS
pg_stat_get_buf_written_backend() AS buffers_backend,
pg_stat_get_buf_alloc() AS buffers_alloc;
CREATE VIEW pg_user_mappings AS
SELECT
U.oid AS umid,
S.oid AS srvid,
S.srvname AS srvname,
U.umuser AS umuser,
CASE WHEN U.umuser = 0 THEN
'public'
ELSE
A.rolname
END AS usename,
CASE WHEN pg_has_role(S.srvowner, 'USAGE') OR has_server_privilege(S.oid, 'USAGE') THEN
U.umoptions
ELSE
NULL
END AS umoptions
FROM pg_user_mapping U
LEFT JOIN pg_authid A ON (A.oid = U.umuser) JOIN
pg_foreign_server S ON (U.umserver = S.oid);
REVOKE ALL on pg_user_mapping FROM public;
-- Tsearch debug function. Defined here because it'd be pretty unwieldy
-- to put it into pg_proc.h
......
......@@ -4,7 +4,7 @@
# Makefile for backend/commands
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/commands/Makefile,v 1.38 2008/02/19 10:30:07 petere Exp $
# $PostgreSQL: pgsql/src/backend/commands/Makefile,v 1.39 2008/12/19 16:25:17 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
OBJS = aggregatecmds.o alter.o analyze.o async.o cluster.o comment.o \
conversioncmds.o copy.o \
dbcommands.o define.o discard.o explain.o functioncmds.o \
dbcommands.o define.o discard.o explain.o foreigncmds.o functioncmds.o \
indexcmds.o lockcmds.o operatorcmds.o opclasscmds.o \
portalcmds.o prepare.o proclang.o \
schemacmds.o sequence.o tablecmds.o tablespace.o trigger.o \
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.29 2008/06/15 01:25:53 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.30 2008/12/19 16:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -270,6 +270,15 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
AlterTSConfigurationOwner(stmt->object, newowner);
break;
case OBJECT_FDW:
AlterForeignDataWrapperOwner(strVal(linitial(stmt->object)),
newowner);
break;
case OBJECT_FOREIGN_SERVER:
AlterForeignServerOwner(strVal(linitial(stmt->object)), newowner);
break;
default:
elog(ERROR, "unrecognized AlterOwnerStmt type: %d",
(int) stmt->objectType);
......
This diff is collapsed.
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for foreign
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/foreign/Makefile,v 1.1 2008/12/19 16:25:17 petere Exp $
#
#-------------------------------------------------------------------------
subdir = src/backend/foreign
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
OBJS= foreign.o
include $(top_srcdir)/src/backend/common.mk
FDW = dummy postgresql
$(addsuffix -fdw,all install installdirs uninstall distprep):
for dir in $(FDW); do $(MAKE) -C $$dir `echo $@ | sed 's/-fdw$$//'` || exit; done
clean distclean maintainer-clean:
for dir in $(FDW); do $(MAKE) -C $$dir $@ || exit; done
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for dummy foreign-data wrapper
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/foreign/dummy/Makefile,v 1.1 2008/12/19 16:25:17 petere Exp $
#
#-------------------------------------------------------------------------
subdir = src/backend/foreign/dummy
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
NAME = dummy_fdw
OBJS = dummy_fdw.o
include $(top_srcdir)/src/Makefile.shlib
all: all-shared-lib
install: all install-lib
installdirs: installdirs-lib
clean distclean maintainer-clean: clean-lib
rm -f $(OBJS)
/*-------------------------------------------------------------------------
*
* dummy_fdw.c
* "dummy" foreign-data wrapper
*
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/foreign/dummy/dummy_fdw.c,v 1.1 2008/12/19 16:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "fmgr.h"
#include "foreign/foreign.h"
PG_MODULE_MAGIC;
/*
* This looks like a complete waste right now, but it is useful for
* testing, and will become more interesting as more parts of the
* interface are implemented.
*/
This diff is collapsed.
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for postgresql foreign-data wrapper
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/foreign/postgresql/Makefile,v 1.1 2008/12/19 16:25:17 petere Exp $
#
#-------------------------------------------------------------------------
subdir = src/backend/foreign/postgresql
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
NAME = postgresql_fdw
OBJS = postgresql_fdw.o
include $(top_srcdir)/src/Makefile.shlib
all: all-shared-lib
install: all install-lib
installdirs: installdirs-lib
clean distclean maintainer-clean: clean-lib
rm -f $(OBJS)
/*-------------------------------------------------------------------------
*
* postgresql_fdw.c
* foreign-data wrapper for postgresql (libpq) connections.
*
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/foreign/postgresql/postgresql_fdw.c,v 1.1 2008/12/19 16:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "fmgr.h"
#include "lib/stringinfo.h"
#include "nodes/value.h"
#include "nodes/parsenodes.h"
#include "nodes/makefuncs.h"
#include "foreign/foreign.h"
PG_MODULE_MAGIC;
/*
* Describes the valid options for postgresql FDW, server and user mapping.
*/
typedef struct ConnectionOptions {
const char *optname; /* Option name */
GenericOptionFlags optflags; /* Option usage bitmap */
} ConnectionOptions;
/*
* Copied from fe-connect.c PQconninfoOptions.
*
* The list is small - don't bother with bsearch if it stays so.
*/
static ConnectionOptions libpq_conninfo_options[] = {
{ "authtype", ServerOpt },
{ "service", ServerOpt },
{ "user", UserMappingOpt },
{ "password", UserMappingOpt },
{ "connect_timeout", ServerOpt },
{ "dbname", ServerOpt },
{ "host", ServerOpt },
{ "hostaddr", ServerOpt },
{ "port", ServerOpt },
{ "tty", ServerOpt },
{ "options", ServerOpt },
{ "requiressl", ServerOpt },
{ "sslmode", ServerOpt },
{ "gsslib", ServerOpt },
{ NULL, InvalidOpt }
};
void _PG_fini(void);
/*
* Check if the provided option is one of libpq conninfo options.
* We look at only options with matching flags.
*/
static bool
is_conninfo_option(const char *option, GenericOptionFlags flags)
{
ConnectionOptions *opt;
for (opt = libpq_conninfo_options; opt->optname != NULL; opt++)
if (flags & opt->optflags && strcmp(opt->optname, option) == 0)
return true;
return false;
}
/*
* Validate the generic option given to SERVER or USER MAPPING.
* Raise an ERROR if the option or its value is considered
* invalid.
*
* Valid server options are all libpq conninfo options except
* user and password -- these may only appear in USER MAPPING options.
*/
void
_pg_validateOptionList(ForeignDataWrapper *fdw, GenericOptionFlags flags,
List *options)
{
ListCell *cell;
foreach (cell, options)
{
DefElem *def = lfirst(cell);
if (!is_conninfo_option(def->defname, flags))
{
ConnectionOptions *opt;
StringInfoData buf;
const char *objtype;
/*
* Unknown option specified, complain about it. Provide a hint
* with list of valid options for the object.
*/
initStringInfo(&buf);
for (opt = libpq_conninfo_options; opt->optname != NULL; opt++)
if (flags & opt->optflags)
appendStringInfo(&buf, "%s%s", (buf.len > 0) ? ", " : "",
opt->optname);
if (flags & ServerOpt)
objtype = "server";
else if (flags & UserMappingOpt)
objtype = "user mapping";
else if (flags & FdwOpt)
objtype = "foreign-data wrapper";
else
objtype = "???";
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid option \"%s\" to %s", def->defname, objtype),
errhint("valid %s options are: %s", objtype, buf.data)));
}
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.60 2008/09/01 20:42:44 tgl Exp $
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.61 2008/12/19 16:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -361,3 +361,16 @@ makeDefElem(char *name, Node *arg)
res->arg = arg;
return res;
}
/*
* makeOptionDefElem -
* build an OptionDefElem node
*/
OptionDefElem *
makeOptionDefElem(int op, DefElem *def)
{
OptionDefElem *res = makeNode(OptionDefElem);
res->alter_op = op;
res->def = def;
return res;
}
This diff is collapsed.
......@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.205 2008/10/27 09:37:47 petere Exp $
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.206 2008/12/19 16:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -229,6 +229,7 @@ const ScanKeyword ScanKeywords[] = {
{"least", LEAST, COL_NAME_KEYWORD},
{"left", LEFT, TYPE_FUNC_NAME_KEYWORD},
{"level", LEVEL, UNRESERVED_KEYWORD},
{"library", LIBRARY, UNRESERVED_KEYWORD},
{"like", LIKE, TYPE_FUNC_NAME_KEYWORD},
{"limit", LIMIT, RESERVED_KEYWORD},
{"listen", LISTEN, UNRESERVED_KEYWORD},
......@@ -281,6 +282,7 @@ const ScanKeyword ScanKeywords[] = {
{"only", ONLY, RESERVED_KEYWORD},
{"operator", OPERATOR, UNRESERVED_KEYWORD},
{"option", OPTION, UNRESERVED_KEYWORD},
{"options", OPTIONS, UNRESERVED_KEYWORD},
{"or", OR, RESERVED_KEYWORD},
{"order", ORDER, RESERVED_KEYWORD},
{"out", OUT_P, COL_NAME_KEYWORD},
......@@ -339,6 +341,7 @@ const ScanKeyword ScanKeywords[] = {
{"select", SELECT, RESERVED_KEYWORD},
{"sequence", SEQUENCE, UNRESERVED_KEYWORD},
{"serializable", SERIALIZABLE, UNRESERVED_KEYWORD},
{"server", SERVER, UNRESERVED_KEYWORD},
{"session", SESSION, UNRESERVED_KEYWORD},
{"session_user", SESSION_USER, RESERVED_KEYWORD},
{"set", SET, UNRESERVED_KEYWORD},
......@@ -411,6 +414,7 @@ const ScanKeyword ScanKeywords[] = {
{"with", WITH, RESERVED_KEYWORD},
{"without", WITHOUT, UNRESERVED_KEYWORD},
{"work", WORK, UNRESERVED_KEYWORD},
{"wrapper", WRAPPER, UNRESERVED_KEYWORD},
{"write", WRITE, UNRESERVED_KEYWORD},
{"xml", XML_P, UNRESERVED_KEYWORD},
{"xmlattributes", XMLATTRIBUTES, COL_NAME_KEYWORD},
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.104 2008/05/09 23:32:04 tgl Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.105 2008/12/19 16:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -91,6 +91,8 @@ getSchemaData(int *numTablesPtr)
TSTemplateInfo *tmplinfo;
TSDictInfo *dictinfo;
TSConfigInfo *cfginfo;
FdwInfo *fdwinfo;
ForeignServerInfo *srvinfo;
int numNamespaces;
int numAggregates;
int numInherits;
......@@ -104,6 +106,8 @@ getSchemaData(int *numTablesPtr)
int numTSTemplates;
int numTSDicts;
int numTSConfigs;
int numForeignDataWrappers;
int numForeignServers;
if (g_verbose)
write_msg(NULL, "reading schemas\n");
......@@ -154,6 +158,14 @@ getSchemaData(int *numTablesPtr)
write_msg(NULL, "reading user-defined text search configurations\n");
cfginfo = getTSConfigurations(&numTSConfigs);
if (g_verbose)
write_msg(NULL, "reading user-defined foreign-data wrappers\n");
fdwinfo = getForeignDataWrappers(&numForeignDataWrappers);
if (g_verbose)
write_msg(NULL, "reading user-defined foreign servers\n");
srvinfo = getForeignServers(&numForeignServers);
if (g_verbose)
write_msg(NULL, "reading user-defined operator families\n");
opfinfo = getOpfamilies(&numOpfamilies);
......
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.41 2008/09/08 00:47:40 tgl Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.42 2008/12/19 16:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -687,6 +687,10 @@ do { \
}
else if (strcmp(type, "TABLESPACE") == 0)
CONVERT_PRIV('C', "CREATE");
else if (strcmp(type, "FOREIGN DATA WRAPPER") == 0)
CONVERT_PRIV('U', "USAGE");
else if (strcmp(type, "SERVER") == 0)
CONVERT_PRIV('U', "USAGE");
else
abort();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.35 2008/01/01 19:45:56 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.36 2008/12/19 16:25:18 petere Exp $
*/
#ifndef DESCRIBE_H
#define DESCRIBE_H
......@@ -66,5 +66,14 @@ extern bool listCasts(const char *pattern);
/* \dn */
extern bool listSchemas(const char *pattern, bool verbose);
/* \dew */
extern bool listForeignDataWrappers(const char *pattern, bool verbose);
/* \des */
extern bool listForeignServers(const char *pattern, bool verbose);
/* \deu */
extern bool listUserMappings(const char *pattern, bool verbose);
#endif /* DESCRIBE_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment