Commit d1ba2942 authored by Peter Eisentraut's avatar Peter Eisentraut

Update information schema to SQL:2008

 - yes_or_no domain for "boolean" data
 - new columns for VIEWS view
 - slight section renumbering
parent dcc9d373
<!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.40 2009/07/07 18:23:13 petere Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.41 2009/07/13 20:25:57 petere Exp $ -->
<chapter id="information-schema"> <chapter id="information-schema">
<title>The Information Schema</title> <title>The Information Schema</title>
...@@ -96,19 +96,24 @@ ...@@ -96,19 +96,24 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist>
Every column in the information schema has one of these four types. <varlistentry>
</para> <term><type>yes_or_no</type></term>
<listitem>
<para>
A character string domain that contains
either <literal>YES</literal> or <literal>NO</literal>. This
is used to represent Boolean (true/false) data in the
information schema. (The information schema was invented
before the type <type>boolean</type> was added to the SQL
standard, so this convention is necessary to keep the
information schema backward compatible.)
</para>
</listitem>
</varlistentry>
</variablelist>
<para> Every column in the information schema has one of these five types.
Boolean (true/false) data is represented in the information schema
by a column of type <type>character_data</type> that contains
either <literal>YES</literal> or <literal>NO</literal>. (The
information schema was invented before the type
<type>boolean</type> was added to the SQL standard, so this
convention is necessary to keep the information schema backward
compatible.)
</para> </para>
</sect1> </sect1>
...@@ -184,7 +189,7 @@ ...@@ -184,7 +189,7 @@
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Always <literal>YES</literal></entry> <entry>Always <literal>YES</literal></entry>
</row> </row>
</tbody> </tbody>
...@@ -236,7 +241,7 @@ ...@@ -236,7 +241,7 @@
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the grantee has the admin option on <literal>YES</literal> if the grantee has the admin option on
the role, <literal>NO</literal> if not the role, <literal>NO</literal> if not
...@@ -308,7 +313,7 @@ ...@@ -308,7 +313,7 @@
<row> <row>
<entry><literal>is_nullable</literal></entry> <entry><literal>is_nullable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the attribute is possibly nullable, <literal>YES</literal> if the attribute is possibly nullable,
<literal>NO</literal> if it is known not nullable. <literal>NO</literal> if it is known not nullable.
...@@ -480,7 +485,7 @@ ...@@ -480,7 +485,7 @@
<row> <row>
<entry><literal>is_derived_reference_attribute</literal></entry> <entry><literal>is_derived_reference_attribute</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
</tbody> </tbody>
...@@ -757,7 +762,7 @@ ...@@ -757,7 +762,7 @@
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
</row> </row>
</tbody> </tbody>
...@@ -907,7 +912,7 @@ ...@@ -907,7 +912,7 @@
<row> <row>
<entry><literal>is_nullable</literal></entry> <entry><literal>is_nullable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the column is possibly nullable, <literal>YES</literal> if the column is possibly nullable,
<literal>NO</literal> if it is known not nullable. A not-null <literal>NO</literal> if it is known not nullable. A not-null
...@@ -1148,13 +1153,13 @@ ...@@ -1148,13 +1153,13 @@
<row> <row>
<entry><literal>is_self_referencing</literal></entry> <entry><literal>is_self_referencing</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
<row> <row>
<entry><literal>is_identity</literal></entry> <entry><literal>is_identity</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
...@@ -1190,7 +1195,7 @@ ...@@ -1190,7 +1195,7 @@
<row> <row>
<entry><literal>identity_cycle</literal></entry> <entry><literal>identity_cycle</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
...@@ -1208,7 +1213,7 @@ ...@@ -1208,7 +1213,7 @@
<row> <row>
<entry><literal>is_updatable</literal></entry> <entry><literal>is_updatable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the column is updatable, <literal>YES</literal> if the column is updatable,
<literal>NO</literal> if not (Columns in base tables are always <literal>NO</literal> if not (Columns in base tables are always
...@@ -1544,13 +1549,13 @@ ...@@ -1544,13 +1549,13 @@
<row> <row>
<entry><literal>is_deferrable</literal></entry> <entry><literal>is_deferrable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the constraint is deferrable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the constraint is deferrable, <literal>NO</literal> if not</entry>
</row> </row>
<row> <row>
<entry><literal>initially_deferred</literal></entry> <entry><literal>initially_deferred</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the constraint is deferrable and initially deferred, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the constraint is deferrable and initially deferred, <literal>NO</literal> if not</entry>
</row> </row>
</tbody> </tbody>
...@@ -2545,13 +2550,13 @@ ORDER BY c.ordinal_position; ...@@ -2545,13 +2550,13 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_result</literal></entry> <entry><literal>is_result</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
<row> <row>
<entry><literal>as_locator</literal></entry> <entry><literal>as_locator</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
...@@ -2902,7 +2907,7 @@ ORDER BY c.ordinal_position; ...@@ -2902,7 +2907,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
</row> </row>
</tbody> </tbody>
...@@ -2992,7 +2997,7 @@ ORDER BY c.ordinal_position; ...@@ -2992,7 +2997,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
</row> </row>
</tbody> </tbody>
...@@ -3066,13 +3071,13 @@ ORDER BY c.ordinal_position; ...@@ -3066,13 +3071,13 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
</row> </row>
<row> <row>
<entry><literal>with_hierarchy</literal></entry> <entry><literal>with_hierarchy</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
</tbody> </tbody>
...@@ -3149,7 +3154,7 @@ ORDER BY c.ordinal_position; ...@@ -3149,7 +3154,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
</row> </row>
</tbody> </tbody>
...@@ -3239,7 +3244,7 @@ ORDER BY c.ordinal_position; ...@@ -3239,7 +3244,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
</row> </row>
</tbody> </tbody>
...@@ -3568,7 +3573,7 @@ ORDER BY c.ordinal_position; ...@@ -3568,7 +3573,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_deterministic</literal></entry> <entry><literal>is_deterministic</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
If the function is declared immutable (called deterministic in If the function is declared immutable (called deterministic in
the SQL standard), then <literal>YES</literal>, else the SQL standard), then <literal>YES</literal>, else
...@@ -3589,7 +3594,7 @@ ORDER BY c.ordinal_position; ...@@ -3589,7 +3594,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_null_call</literal></entry> <entry><literal>is_null_call</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
If the function automatically returns null if any of its If the function automatically returns null if any of its
arguments are null, then <literal>YES</literal>, else arguments are null, then <literal>YES</literal>, else
...@@ -3605,7 +3610,7 @@ ORDER BY c.ordinal_position; ...@@ -3605,7 +3610,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>schema_level_routine</literal></entry> <entry><literal>schema_level_routine</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
Always <literal>YES</literal> (The opposite would be a method Always <literal>YES</literal> (The opposite would be a method
of a user-defined type, which is a feature not available in of a user-defined type, which is a feature not available in
...@@ -3621,13 +3626,13 @@ ORDER BY c.ordinal_position; ...@@ -3621,13 +3626,13 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_user_defined_cast</literal></entry> <entry><literal>is_user_defined_cast</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
<row> <row>
<entry><literal>is_implicitly_invocable</literal></entry> <entry><literal>is_implicitly_invocable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
...@@ -3662,7 +3667,7 @@ ORDER BY c.ordinal_position; ...@@ -3662,7 +3667,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>as_locator</literal></entry> <entry><literal>as_locator</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
...@@ -3680,13 +3685,13 @@ ORDER BY c.ordinal_position; ...@@ -3680,13 +3685,13 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>new_savepoint_level</literal></entry> <entry><literal>new_savepoint_level</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
<row> <row>
<entry><literal>is_udt_dependent</literal></entry> <entry><literal>is_udt_dependent</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
...@@ -3698,7 +3703,7 @@ ORDER BY c.ordinal_position; ...@@ -3698,7 +3703,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>result_cast_as_locator</literal></entry> <entry><literal>result_cast_as_locator</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
...@@ -4012,7 +4017,7 @@ ORDER BY c.ordinal_position; ...@@ -4012,7 +4017,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>cycle_option</literal></entry> <entry><literal>cycle_option</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Not yet implemented</entry> <entry>Not yet implemented</entry>
</row> </row>
</tbody> </tbody>
...@@ -4070,7 +4075,7 @@ ORDER BY c.ordinal_position; ...@@ -4070,7 +4075,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_supported</literal></entry> <entry><literal>is_supported</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the feature is fully supported by the <literal>YES</literal> if the feature is fully supported by the
current version of <productname>PostgreSQL</>, <literal>NO</literal> if not current version of <productname>PostgreSQL</>, <literal>NO</literal> if not
...@@ -4289,7 +4294,7 @@ ORDER BY c.ordinal_position; ...@@ -4289,7 +4294,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_supported</literal></entry> <entry><literal>is_supported</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the package is fully supported by the <literal>YES</literal> if the package is fully supported by the
current version of <productname>PostgreSQL</>, <literal>NO</literal> if not current version of <productname>PostgreSQL</>, <literal>NO</literal> if not
...@@ -4351,7 +4356,7 @@ ORDER BY c.ordinal_position; ...@@ -4351,7 +4356,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_supported</literal></entry> <entry><literal>is_supported</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the part is fully supported by the <literal>YES</literal> if the part is fully supported by the
current version of <productname>PostgreSQL</>, current version of <productname>PostgreSQL</>,
...@@ -4569,13 +4574,13 @@ ORDER BY c.ordinal_position; ...@@ -4569,13 +4574,13 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_deferrable</literal></entry> <entry><literal>is_deferrable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the constraint is deferrable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the constraint is deferrable, <literal>NO</literal> if not</entry>
</row> </row>
<row> <row>
<entry><literal>initially_deferred</literal></entry> <entry><literal>initially_deferred</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the constraint is deferrable and initially deferred, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the constraint is deferrable and initially deferred, <literal>NO</literal> if not</entry>
</row> </row>
</tbody> </tbody>
...@@ -4649,13 +4654,13 @@ ORDER BY c.ordinal_position; ...@@ -4649,13 +4654,13 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
</row> </row>
<row> <row>
<entry><literal>with_hierarchy</literal></entry> <entry><literal>with_hierarchy</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
</tbody> </tbody>
...@@ -4747,7 +4752,7 @@ ORDER BY c.ordinal_position; ...@@ -4747,7 +4752,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_insertable_into</literal></entry> <entry><literal>is_insertable_into</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the table is insertable into, <literal>YES</literal> if the table is insertable into,
<literal>NO</literal> if not (Base tables are always insertable <literal>NO</literal> if not (Base tables are always insertable
...@@ -4757,7 +4762,7 @@ ORDER BY c.ordinal_position; ...@@ -4757,7 +4762,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_typed</literal></entry> <entry><literal>is_typed</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row> </row>
...@@ -5025,7 +5030,7 @@ ORDER BY c.ordinal_position; ...@@ -5025,7 +5030,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_grantable</literal></entry> <entry><literal>is_grantable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry> <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
</row> </row>
</tbody> </tbody>
...@@ -5434,7 +5439,7 @@ ORDER BY c.ordinal_position; ...@@ -5434,7 +5439,7 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_updatable</literal></entry> <entry><literal>is_updatable</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the view is updatable (allows <literal>YES</literal> if the view is updatable (allows
<command>UPDATE</command> and <command>DELETE</command>), <command>UPDATE</command> and <command>DELETE</command>),
...@@ -5444,12 +5449,30 @@ ORDER BY c.ordinal_position; ...@@ -5444,12 +5449,30 @@ ORDER BY c.ordinal_position;
<row> <row>
<entry><literal>is_insertable_into</literal></entry> <entry><literal>is_insertable_into</literal></entry>
<entry><type>character_data</type></entry> <entry><type>yes_or_no</type></entry>
<entry> <entry>
<literal>YES</literal> if the view is insertable into (allows <literal>YES</literal> if the view is insertable into (allows
<command>INSERT</command>), <literal>NO</literal> if not <command>INSERT</command>), <literal>NO</literal> if not
</entry> </entry>
</row> </row>
<row>
<entry><literal>is_trigger_updatable</literal></entry>
<entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row>
<row>
<entry><literal>is_trigger_deletable</literal></entry>
<entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row>
<row>
<entry><literal>is_trigger_insertable_into</literal></entry>
<entry><type>yes_or_no</type></entry>
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
......
/* /*
* SQL Information Schema * SQL Information Schema
* as defined in ISO/IEC 9075-11:2003 * as defined in ISO/IEC 9075-11:2008
* *
* Copyright (c) 2003-2009, PostgreSQL Global Development Group * Copyright (c) 2003-2009, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.56 2009/07/07 19:28:00 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.57 2009/07/13 20:25:57 petere Exp $
*/ */
/* /*
...@@ -221,19 +221,27 @@ GRANT SELECT ON information_schema_catalog_name TO PUBLIC; ...@@ -221,19 +221,27 @@ GRANT SELECT ON information_schema_catalog_name TO PUBLIC;
CREATE DOMAIN time_stamp AS timestamp(2) with time zone CREATE DOMAIN time_stamp AS timestamp(2) with time zone
DEFAULT current_timestamp(2); DEFAULT current_timestamp(2);
/*
* 5.7
* YES_OR_NO domain
*/
CREATE DOMAIN yes_or_no AS character varying(3)
CONSTRAINT yes_or_no_check CHECK (value IN ('YES', 'NO'));
-- 5.7 ADMINISTRABLE_ROLE_AUTHORIZATIONS view appears later.
-- 5.8 ADMINISTRABLE_ROLE_AUTHORIZATIONS view appears later.
/* /*
* 5.8 * 5.9
* APPLICABLE_ROLES view * APPLICABLE_ROLES view
*/ */
CREATE VIEW applicable_roles AS CREATE VIEW applicable_roles AS
SELECT CAST(a.rolname AS sql_identifier) AS grantee, SELECT CAST(a.rolname AS sql_identifier) AS grantee,
CAST(b.rolname AS sql_identifier) AS role_name, CAST(b.rolname AS sql_identifier) AS role_name,
CAST(CASE WHEN m.admin_option THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable CAST(CASE WHEN m.admin_option THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable
FROM pg_auth_members m FROM pg_auth_members m
JOIN pg_authid a ON (m.member = a.oid) JOIN pg_authid a ON (m.member = a.oid)
JOIN pg_authid b ON (m.roleid = b.oid) JOIN pg_authid b ON (m.roleid = b.oid)
...@@ -243,7 +251,7 @@ GRANT SELECT ON applicable_roles TO PUBLIC; ...@@ -243,7 +251,7 @@ GRANT SELECT ON applicable_roles TO PUBLIC;
/* /*
* 5.7 * 5.8
* ADMINISTRABLE_ROLE_AUTHORIZATIONS view * ADMINISTRABLE_ROLE_AUTHORIZATIONS view
*/ */
...@@ -256,7 +264,7 @@ GRANT SELECT ON administrable_role_authorizations TO PUBLIC; ...@@ -256,7 +264,7 @@ GRANT SELECT ON administrable_role_authorizations TO PUBLIC;
/* /*
* 5.9 * 5.10
* ASSERTIONS view * ASSERTIONS view
*/ */
...@@ -264,7 +272,7 @@ GRANT SELECT ON administrable_role_authorizations TO PUBLIC; ...@@ -264,7 +272,7 @@ GRANT SELECT ON administrable_role_authorizations TO PUBLIC;
/* /*
* 5.10 * 5.11
* ATTRIBUTES view * ATTRIBUTES view
*/ */
...@@ -276,7 +284,7 @@ CREATE VIEW attributes AS ...@@ -276,7 +284,7 @@ CREATE VIEW attributes AS
CAST(a.attnum AS cardinal_number) AS ordinal_position, CAST(a.attnum AS cardinal_number) AS ordinal_position,
CAST(pg_get_expr(ad.adbin, ad.adrelid) AS character_data) AS attribute_default, CAST(pg_get_expr(ad.adbin, ad.adrelid) AS character_data) AS attribute_default,
CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END
AS character_data) AS yes_or_no)
AS is_nullable, AS is_nullable,
CAST( CAST(
...@@ -337,7 +345,7 @@ CREATE VIEW attributes AS ...@@ -337,7 +345,7 @@ CREATE VIEW attributes AS
CAST(null AS cardinal_number) AS maximum_cardinality, CAST(null AS cardinal_number) AS maximum_cardinality,
CAST(a.attnum AS sql_identifier) AS dtd_identifier, CAST(a.attnum AS sql_identifier) AS dtd_identifier,
CAST('NO' AS character_data) AS is_derived_reference_attribute CAST('NO' AS yes_or_no) AS is_derived_reference_attribute
FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum), FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum),
pg_class c, pg_namespace nc, pg_class c, pg_namespace nc,
...@@ -353,7 +361,7 @@ GRANT SELECT ON attributes TO PUBLIC; ...@@ -353,7 +361,7 @@ GRANT SELECT ON attributes TO PUBLIC;
/* /*
* 5.11 * 5.12
* CHARACTER_SETS view * CHARACTER_SETS view
*/ */
...@@ -361,7 +369,7 @@ GRANT SELECT ON attributes TO PUBLIC; ...@@ -361,7 +369,7 @@ GRANT SELECT ON attributes TO PUBLIC;
/* /*
* 5.12 * 5.13
* CHECK_CONSTRAINT_ROUTINE_USAGE view * CHECK_CONSTRAINT_ROUTINE_USAGE view
*/ */
...@@ -386,7 +394,7 @@ GRANT SELECT ON check_constraint_routine_usage TO PUBLIC; ...@@ -386,7 +394,7 @@ GRANT SELECT ON check_constraint_routine_usage TO PUBLIC;
/* /*
* 5.13 * 5.14
* CHECK_CONSTRAINTS view * CHECK_CONSTRAINTS view
*/ */
...@@ -424,14 +432,14 @@ GRANT SELECT ON check_constraints TO PUBLIC; ...@@ -424,14 +432,14 @@ GRANT SELECT ON check_constraints TO PUBLIC;
/* /*
* 5.14 * 5.15
* COLLATIONS view * COLLATIONS view
*/ */
-- feature not supported -- feature not supported
/* /*
* 5.15 * 5.16
* COLLATION_CHARACTER_SET_APPLICABILITY view * COLLATION_CHARACTER_SET_APPLICABILITY view
*/ */
...@@ -439,7 +447,7 @@ GRANT SELECT ON check_constraints TO PUBLIC; ...@@ -439,7 +447,7 @@ GRANT SELECT ON check_constraints TO PUBLIC;
/* /*
* 5.16 * 5.17
* COLUMN_COLUMN_USAGE view * COLUMN_COLUMN_USAGE view
*/ */
...@@ -447,7 +455,7 @@ GRANT SELECT ON check_constraints TO PUBLIC; ...@@ -447,7 +455,7 @@ GRANT SELECT ON check_constraints TO PUBLIC;
/* /*
* 5.17 * 5.18
* COLUMN_DOMAIN_USAGE view * COLUMN_DOMAIN_USAGE view
*/ */
...@@ -477,7 +485,7 @@ GRANT SELECT ON column_domain_usage TO PUBLIC; ...@@ -477,7 +485,7 @@ GRANT SELECT ON column_domain_usage TO PUBLIC;
/* /*
* 5.18 * 5.19
* COLUMN_PRIVILEGES * COLUMN_PRIVILEGES
*/ */
...@@ -497,7 +505,7 @@ CREATE VIEW column_privileges AS ...@@ -497,7 +505,7 @@ CREATE VIEW column_privileges AS
makeaclitem(grantee.oid, u_grantor.oid, pr.type, true)) makeaclitem(grantee.oid, u_grantor.oid, pr.type, true))
OR aclcontains(a.attacl, OR aclcontains(a.attacl,
makeaclitem(grantee.oid, u_grantor.oid, pr.type, true)) makeaclitem(grantee.oid, u_grantor.oid, pr.type, true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable
FROM pg_attribute a, FROM pg_attribute a,
pg_class c, pg_class c,
...@@ -530,7 +538,7 @@ GRANT SELECT ON column_privileges TO PUBLIC; ...@@ -530,7 +538,7 @@ GRANT SELECT ON column_privileges TO PUBLIC;
/* /*
* 5.19 * 5.20
* COLUMN_UDT_USAGE view * COLUMN_UDT_USAGE view
*/ */
...@@ -558,7 +566,7 @@ GRANT SELECT ON column_udt_usage TO PUBLIC; ...@@ -558,7 +566,7 @@ GRANT SELECT ON column_udt_usage TO PUBLIC;
/* /*
* 5.20 * 5.21
* COLUMNS view * COLUMNS view
*/ */
...@@ -570,7 +578,7 @@ CREATE VIEW columns AS ...@@ -570,7 +578,7 @@ CREATE VIEW columns AS
CAST(a.attnum AS cardinal_number) AS ordinal_position, CAST(a.attnum AS cardinal_number) AS ordinal_position,
CAST(pg_get_expr(ad.adbin, ad.adrelid) AS character_data) AS column_default, CAST(pg_get_expr(ad.adbin, ad.adrelid) AS character_data) AS column_default,
CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END
AS character_data) AS yes_or_no)
AS is_nullable, AS is_nullable,
CAST( CAST(
...@@ -644,15 +652,15 @@ CREATE VIEW columns AS ...@@ -644,15 +652,15 @@ CREATE VIEW columns AS
CAST(null AS cardinal_number) AS maximum_cardinality, CAST(null AS cardinal_number) AS maximum_cardinality,
CAST(a.attnum AS sql_identifier) AS dtd_identifier, CAST(a.attnum AS sql_identifier) AS dtd_identifier,
CAST('NO' AS character_data) AS is_self_referencing, CAST('NO' AS yes_or_no) AS is_self_referencing,
CAST('NO' AS character_data) AS is_identity, CAST('NO' AS yes_or_no) AS is_identity,
CAST(null AS character_data) AS identity_generation, CAST(null AS character_data) AS identity_generation,
CAST(null AS character_data) AS identity_start, CAST(null AS character_data) AS identity_start,
CAST(null AS character_data) AS identity_increment, CAST(null AS character_data) AS identity_increment,
CAST(null AS character_data) AS identity_maximum, CAST(null AS character_data) AS identity_maximum,
CAST(null AS character_data) AS identity_minimum, CAST(null AS character_data) AS identity_minimum,
CAST(null AS character_data) AS identity_cycle, CAST(null AS yes_or_no) AS identity_cycle,
CAST('NEVER' AS character_data) AS is_generated, CAST('NEVER' AS character_data) AS is_generated,
CAST(null AS character_data) AS generation_expression, CAST(null AS character_data) AS generation_expression,
...@@ -661,7 +669,7 @@ CREATE VIEW columns AS ...@@ -661,7 +669,7 @@ CREATE VIEW columns AS
OR (c.relkind = 'v' OR (c.relkind = 'v'
AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead) AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead)
AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead)) AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_updatable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_updatable
FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum), FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum),
pg_class c, pg_namespace nc, pg_class c, pg_namespace nc,
...@@ -684,7 +692,7 @@ GRANT SELECT ON columns TO PUBLIC; ...@@ -684,7 +692,7 @@ GRANT SELECT ON columns TO PUBLIC;
/* /*
* 5.21 * 5.22
* CONSTRAINT_COLUMN_USAGE view * CONSTRAINT_COLUMN_USAGE view
*/ */
...@@ -736,7 +744,7 @@ GRANT SELECT ON constraint_column_usage TO PUBLIC; ...@@ -736,7 +744,7 @@ GRANT SELECT ON constraint_column_usage TO PUBLIC;
/* /*
* 5.22 * 5.23
* CONSTRAINT_TABLE_USAGE view * CONSTRAINT_TABLE_USAGE view
*/ */
...@@ -760,11 +768,11 @@ CREATE VIEW constraint_table_usage AS ...@@ -760,11 +768,11 @@ CREATE VIEW constraint_table_usage AS
GRANT SELECT ON constraint_table_usage TO PUBLIC; GRANT SELECT ON constraint_table_usage TO PUBLIC;
-- 5.23 DATA_TYPE_PRIVILEGES view appears later. -- 5.24 DATA_TYPE_PRIVILEGES view appears later.
/* /*
* 5.24 * 5.25
* DIRECT_SUPERTABLES view * DIRECT_SUPERTABLES view
*/ */
...@@ -772,7 +780,7 @@ GRANT SELECT ON constraint_table_usage TO PUBLIC; ...@@ -772,7 +780,7 @@ GRANT SELECT ON constraint_table_usage TO PUBLIC;
/* /*
* 5.25 * 5.26
* DIRECT_SUPERTYPES view * DIRECT_SUPERTYPES view
*/ */
...@@ -780,7 +788,7 @@ GRANT SELECT ON constraint_table_usage TO PUBLIC; ...@@ -780,7 +788,7 @@ GRANT SELECT ON constraint_table_usage TO PUBLIC;
/* /*
* 5.26 * 5.27
* DOMAIN_CONSTRAINTS view * DOMAIN_CONSTRAINTS view
*/ */
...@@ -792,9 +800,9 @@ CREATE VIEW domain_constraints AS ...@@ -792,9 +800,9 @@ CREATE VIEW domain_constraints AS
CAST(n.nspname AS sql_identifier) AS domain_schema, CAST(n.nspname AS sql_identifier) AS domain_schema,
CAST(t.typname AS sql_identifier) AS domain_name, CAST(t.typname AS sql_identifier) AS domain_name,
CAST(CASE WHEN condeferrable THEN 'YES' ELSE 'NO' END CAST(CASE WHEN condeferrable THEN 'YES' ELSE 'NO' END
AS character_data) AS is_deferrable, AS yes_or_no) AS is_deferrable,
CAST(CASE WHEN condeferred THEN 'YES' ELSE 'NO' END CAST(CASE WHEN condeferred THEN 'YES' ELSE 'NO' END
AS character_data) AS initially_deferred AS yes_or_no) AS initially_deferred
FROM pg_namespace rs, pg_namespace n, pg_constraint con, pg_type t FROM pg_namespace rs, pg_namespace n, pg_constraint con, pg_type t
WHERE rs.oid = con.connamespace WHERE rs.oid = con.connamespace
AND n.oid = t.typnamespace AND n.oid = t.typnamespace
...@@ -829,7 +837,7 @@ GRANT SELECT ON domain_udt_usage TO PUBLIC; ...@@ -829,7 +837,7 @@ GRANT SELECT ON domain_udt_usage TO PUBLIC;
/* /*
* 5.27 * 5.28
* DOMAINS view * DOMAINS view
*/ */
...@@ -910,11 +918,11 @@ CREATE VIEW domains AS ...@@ -910,11 +918,11 @@ CREATE VIEW domains AS
GRANT SELECT ON domains TO PUBLIC; GRANT SELECT ON domains TO PUBLIC;
-- 5.28 ELEMENT_TYPES view appears later. -- 5.29 ELEMENT_TYPES view appears later.
/* /*
* 5.29 * 5.30
* ENABLED_ROLES view * ENABLED_ROLES view
*/ */
...@@ -927,7 +935,7 @@ GRANT SELECT ON enabled_roles TO PUBLIC; ...@@ -927,7 +935,7 @@ GRANT SELECT ON enabled_roles TO PUBLIC;
/* /*
* 5.30 * 5.31
* FIELDS view * FIELDS view
*/ */
...@@ -935,7 +943,7 @@ GRANT SELECT ON enabled_roles TO PUBLIC; ...@@ -935,7 +943,7 @@ GRANT SELECT ON enabled_roles TO PUBLIC;
/* /*
* 5.31 * 5.32
* KEY_COLUMN_USAGE view * KEY_COLUMN_USAGE view
*/ */
...@@ -978,7 +986,7 @@ GRANT SELECT ON key_column_usage TO PUBLIC; ...@@ -978,7 +986,7 @@ GRANT SELECT ON key_column_usage TO PUBLIC;
/* /*
* 5.32 * 5.33
* METHOD_SPECIFICATION_PARAMETERS view * METHOD_SPECIFICATION_PARAMETERS view
*/ */
...@@ -986,7 +994,7 @@ GRANT SELECT ON key_column_usage TO PUBLIC; ...@@ -986,7 +994,7 @@ GRANT SELECT ON key_column_usage TO PUBLIC;
/* /*
* 5.33 * 5.34
* METHOD_SPECIFICATIONS view * METHOD_SPECIFICATIONS view
*/ */
...@@ -994,7 +1002,7 @@ GRANT SELECT ON key_column_usage TO PUBLIC; ...@@ -994,7 +1002,7 @@ GRANT SELECT ON key_column_usage TO PUBLIC;
/* /*
* 5.34 * 5.35
* PARAMETERS view * PARAMETERS view
*/ */
...@@ -1011,8 +1019,8 @@ CREATE VIEW parameters AS ...@@ -1011,8 +1019,8 @@ CREATE VIEW parameters AS
WHEN proargmodes[(ss.x).n] = 'v' THEN 'IN' WHEN proargmodes[(ss.x).n] = 'v' THEN 'IN'
WHEN proargmodes[(ss.x).n] = 't' THEN 'OUT' WHEN proargmodes[(ss.x).n] = 't' THEN 'OUT'
END AS character_data) AS parameter_mode, END AS character_data) AS parameter_mode,
CAST('NO' AS character_data) AS is_result, CAST('NO' AS yes_or_no) AS is_result,
CAST('NO' AS character_data) AS as_locator, CAST('NO' AS yes_or_no) AS as_locator,
CAST(NULLIF(proargnames[(ss.x).n], '') AS sql_identifier) AS parameter_name, CAST(NULLIF(proargnames[(ss.x).n], '') AS sql_identifier) AS parameter_name,
CAST( CAST(
CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY' CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY'
...@@ -1056,7 +1064,7 @@ GRANT SELECT ON parameters TO PUBLIC; ...@@ -1056,7 +1064,7 @@ GRANT SELECT ON parameters TO PUBLIC;
/* /*
* 5.35 * 5.36
* REFERENCED_TYPES view * REFERENCED_TYPES view
*/ */
...@@ -1064,7 +1072,7 @@ GRANT SELECT ON parameters TO PUBLIC; ...@@ -1064,7 +1072,7 @@ GRANT SELECT ON parameters TO PUBLIC;
/* /*
* 5.36 * 5.37
* REFERENTIAL_CONSTRAINTS view * REFERENTIAL_CONSTRAINTS view
*/ */
...@@ -1122,7 +1130,7 @@ GRANT SELECT ON referential_constraints TO PUBLIC; ...@@ -1122,7 +1130,7 @@ GRANT SELECT ON referential_constraints TO PUBLIC;
/* /*
* 5.37 * 5.38
* ROLE_COLUMN_GRANTS view * ROLE_COLUMN_GRANTS view
*/ */
...@@ -1142,7 +1150,7 @@ CREATE VIEW role_column_grants AS ...@@ -1142,7 +1150,7 @@ CREATE VIEW role_column_grants AS
makeaclitem(g_grantee.oid, u_grantor.oid, pr.type, true)) makeaclitem(g_grantee.oid, u_grantor.oid, pr.type, true))
OR aclcontains(a.attacl, OR aclcontains(a.attacl,
makeaclitem(g_grantee.oid, u_grantor.oid, pr.type, true)) makeaclitem(g_grantee.oid, u_grantor.oid, pr.type, true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable
FROM pg_attribute a, FROM pg_attribute a,
pg_class c, pg_class c,
...@@ -1170,7 +1178,7 @@ GRANT SELECT ON role_column_grants TO PUBLIC; ...@@ -1170,7 +1178,7 @@ GRANT SELECT ON role_column_grants TO PUBLIC;
/* /*
* 5.38 * 5.39
* ROLE_ROUTINE_GRANTS view * ROLE_ROUTINE_GRANTS view
*/ */
...@@ -1190,7 +1198,7 @@ CREATE VIEW role_routine_grants AS ...@@ -1190,7 +1198,7 @@ CREATE VIEW role_routine_grants AS
pg_has_role(g_grantee.oid, p.proowner, 'USAGE') pg_has_role(g_grantee.oid, p.proowner, 'USAGE')
OR aclcontains(p.proacl, OR aclcontains(p.proacl,
makeaclitem(g_grantee.oid, u_grantor.oid, 'EXECUTE', true)) makeaclitem(g_grantee.oid, u_grantor.oid, 'EXECUTE', true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable
FROM pg_proc p, FROM pg_proc p,
pg_namespace n, pg_namespace n,
...@@ -1207,7 +1215,7 @@ GRANT SELECT ON role_routine_grants TO PUBLIC; ...@@ -1207,7 +1215,7 @@ GRANT SELECT ON role_routine_grants TO PUBLIC;
/* /*
* 5.39 * 5.40
* ROLE_TABLE_GRANTS view * ROLE_TABLE_GRANTS view
*/ */
...@@ -1224,8 +1232,8 @@ CREATE VIEW role_table_grants AS ...@@ -1224,8 +1232,8 @@ CREATE VIEW role_table_grants AS
pg_has_role(g_grantee.oid, c.relowner, 'USAGE') pg_has_role(g_grantee.oid, c.relowner, 'USAGE')
OR aclcontains(c.relacl, OR aclcontains(c.relacl,
makeaclitem(g_grantee.oid, u_grantor.oid, pr.type, true)) makeaclitem(g_grantee.oid, u_grantor.oid, pr.type, true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable, THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable,
CAST('NO' AS character_data) AS with_hierarchy CAST('NO' AS yes_or_no) AS with_hierarchy
FROM pg_class c, FROM pg_class c,
pg_namespace nc, pg_namespace nc,
...@@ -1250,7 +1258,7 @@ GRANT SELECT ON role_table_grants TO PUBLIC; ...@@ -1250,7 +1258,7 @@ GRANT SELECT ON role_table_grants TO PUBLIC;
/* /*
* 5.40 * 5.41
* ROLE_TABLE_METHOD_GRANTS view * ROLE_TABLE_METHOD_GRANTS view
*/ */
...@@ -1258,7 +1266,7 @@ GRANT SELECT ON role_table_grants TO PUBLIC; ...@@ -1258,7 +1266,7 @@ GRANT SELECT ON role_table_grants TO PUBLIC;
/* /*
* 5.41 * 5.42
* ROLE_USAGE_GRANTS view * ROLE_USAGE_GRANTS view
*/ */
...@@ -1278,7 +1286,7 @@ CREATE VIEW role_usage_grants AS ...@@ -1278,7 +1286,7 @@ CREATE VIEW role_usage_grants AS
pg_has_role(g_grantee.oid, fdw.fdwowner, 'USAGE') pg_has_role(g_grantee.oid, fdw.fdwowner, 'USAGE')
OR aclcontains(fdw.fdwacl, OR aclcontains(fdw.fdwacl,
makeaclitem(g_grantee.oid, u_grantor.oid, 'USAGE', true)) makeaclitem(g_grantee.oid, u_grantor.oid, 'USAGE', true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable
FROM pg_foreign_data_wrapper fdw, FROM pg_foreign_data_wrapper fdw,
pg_authid u_grantor, pg_authid u_grantor,
...@@ -1305,7 +1313,7 @@ CREATE VIEW role_usage_grants AS ...@@ -1305,7 +1313,7 @@ CREATE VIEW role_usage_grants AS
pg_has_role(g_grantee.oid, srv.srvowner, 'USAGE') pg_has_role(g_grantee.oid, srv.srvowner, 'USAGE')
OR aclcontains(srv.srvacl, OR aclcontains(srv.srvacl,
makeaclitem(g_grantee.oid, u_grantor.oid, 'USAGE', true)) makeaclitem(g_grantee.oid, u_grantor.oid, 'USAGE', true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable
FROM pg_foreign_server srv, FROM pg_foreign_server srv,
pg_authid u_grantor, pg_authid u_grantor,
...@@ -1320,7 +1328,7 @@ GRANT SELECT ON role_usage_grants TO PUBLIC; ...@@ -1320,7 +1328,7 @@ GRANT SELECT ON role_usage_grants TO PUBLIC;
/* /*
* 5.42 * 5.43
* ROLE_UDT_GRANTS view * ROLE_UDT_GRANTS view
*/ */
...@@ -1328,7 +1336,7 @@ GRANT SELECT ON role_usage_grants TO PUBLIC; ...@@ -1328,7 +1336,7 @@ GRANT SELECT ON role_usage_grants TO PUBLIC;
/* /*
* 5.43 * 5.44
* ROUTINE_COLUMN_USAGE view * ROUTINE_COLUMN_USAGE view
*/ */
...@@ -1336,7 +1344,7 @@ GRANT SELECT ON role_usage_grants TO PUBLIC; ...@@ -1336,7 +1344,7 @@ GRANT SELECT ON role_usage_grants TO PUBLIC;
/* /*
* 5.44 * 5.45
* ROUTINE_PRIVILEGES view * ROUTINE_PRIVILEGES view
*/ */
...@@ -1356,7 +1364,7 @@ CREATE VIEW routine_privileges AS ...@@ -1356,7 +1364,7 @@ CREATE VIEW routine_privileges AS
pg_has_role(grantee.oid, p.proowner, 'USAGE') pg_has_role(grantee.oid, p.proowner, 'USAGE')
OR aclcontains(p.proacl, OR aclcontains(p.proacl,
makeaclitem(grantee.oid, u_grantor.oid, 'EXECUTE', true)) makeaclitem(grantee.oid, u_grantor.oid, 'EXECUTE', true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable
FROM pg_proc p, FROM pg_proc p,
pg_namespace n, pg_namespace n,
...@@ -1378,7 +1386,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC; ...@@ -1378,7 +1386,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC;
/* /*
* 5.45 * 5.46
* ROUTINE_ROUTINE_USAGE view * ROUTINE_ROUTINE_USAGE view
*/ */
...@@ -1386,7 +1394,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC; ...@@ -1386,7 +1394,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC;
/* /*
* 5.46 * 5.47
* ROUTINE_SEQUENCE_USAGE view * ROUTINE_SEQUENCE_USAGE view
*/ */
...@@ -1394,7 +1402,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC; ...@@ -1394,7 +1402,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC;
/* /*
* 5.47 * 5.48
* ROUTINE_TABLE_USAGE view * ROUTINE_TABLE_USAGE view
*/ */
...@@ -1402,7 +1410,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC; ...@@ -1402,7 +1410,7 @@ GRANT SELECT ON routine_privileges TO PUBLIC;
/* /*
* 5.48 * 5.49
* ROUTINES view * ROUTINES view
*/ */
...@@ -1460,26 +1468,26 @@ CREATE VIEW routines AS ...@@ -1460,26 +1468,26 @@ CREATE VIEW routines AS
CAST(upper(l.lanname) AS character_data) AS external_language, CAST(upper(l.lanname) AS character_data) AS external_language,
CAST('GENERAL' AS character_data) AS parameter_style, CAST('GENERAL' AS character_data) AS parameter_style,
CAST(CASE WHEN p.provolatile = 'i' THEN 'YES' ELSE 'NO' END AS character_data) AS is_deterministic, CAST(CASE WHEN p.provolatile = 'i' THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_deterministic,
CAST('MODIFIES' AS character_data) AS sql_data_access, CAST('MODIFIES' AS character_data) AS sql_data_access,
CAST(CASE WHEN p.proisstrict THEN 'YES' ELSE 'NO' END AS character_data) AS is_null_call, CAST(CASE WHEN p.proisstrict THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_null_call,
CAST(null AS character_data) AS sql_path, CAST(null AS character_data) AS sql_path,
CAST('YES' AS character_data) AS schema_level_routine, CAST('YES' AS yes_or_no) AS schema_level_routine,
CAST(0 AS cardinal_number) AS max_dynamic_result_sets, CAST(0 AS cardinal_number) AS max_dynamic_result_sets,
CAST(null AS character_data) AS is_user_defined_cast, CAST(null AS yes_or_no) AS is_user_defined_cast,
CAST(null AS character_data) AS is_implicitly_invocable, CAST(null AS yes_or_no) AS is_implicitly_invocable,
CAST(CASE WHEN p.prosecdef THEN 'DEFINER' ELSE 'INVOKER' END AS character_data) AS security_type, CAST(CASE WHEN p.prosecdef THEN 'DEFINER' ELSE 'INVOKER' END AS character_data) AS security_type,
CAST(null AS sql_identifier) AS to_sql_specific_catalog, CAST(null AS sql_identifier) AS to_sql_specific_catalog,
CAST(null AS sql_identifier) AS to_sql_specific_schema, CAST(null AS sql_identifier) AS to_sql_specific_schema,
CAST(null AS sql_identifier) AS to_sql_specific_name, CAST(null AS sql_identifier) AS to_sql_specific_name,
CAST('NO' AS character_data) AS as_locator, CAST('NO' AS yes_or_no) AS as_locator,
CAST(null AS time_stamp) AS created, CAST(null AS time_stamp) AS created,
CAST(null AS time_stamp) AS last_altered, CAST(null AS time_stamp) AS last_altered,
CAST(null AS character_data) AS new_savepoint_level, CAST(null AS yes_or_no) AS new_savepoint_level,
CAST('YES' AS character_data) AS is_udt_dependent, -- FIXME? CAST('YES' AS yes_or_no) AS is_udt_dependent, -- FIXME?
CAST(null AS character_data) AS result_cast_from_data_type, CAST(null AS character_data) AS result_cast_from_data_type,
CAST(null AS character_data) AS result_cast_as_locator, CAST(null AS yes_or_no) AS result_cast_as_locator,
CAST(null AS cardinal_number) AS result_cast_char_max_length, CAST(null AS cardinal_number) AS result_cast_char_max_length,
CAST(null AS cardinal_number) AS result_cast_char_octet_length, CAST(null AS cardinal_number) AS result_cast_char_octet_length,
CAST(null AS sql_identifier) AS result_cast_char_set_catalog, CAST(null AS sql_identifier) AS result_cast_char_set_catalog,
...@@ -1515,7 +1523,7 @@ GRANT SELECT ON routines TO PUBLIC; ...@@ -1515,7 +1523,7 @@ GRANT SELECT ON routines TO PUBLIC;
/* /*
* 5.49 * 5.50
* SCHEMATA view * SCHEMATA view
*/ */
...@@ -1534,7 +1542,7 @@ GRANT SELECT ON schemata TO PUBLIC; ...@@ -1534,7 +1542,7 @@ GRANT SELECT ON schemata TO PUBLIC;
/* /*
* 5.50 * 5.51
* SEQUENCES view * SEQUENCES view
*/ */
...@@ -1549,7 +1557,7 @@ CREATE VIEW sequences AS ...@@ -1549,7 +1557,7 @@ CREATE VIEW sequences AS
CAST(null AS cardinal_number) AS maximum_value, -- FIXME CAST(null AS cardinal_number) AS maximum_value, -- FIXME
CAST(null AS cardinal_number) AS minimum_value, -- FIXME CAST(null AS cardinal_number) AS minimum_value, -- FIXME
CAST(null AS cardinal_number) AS increment, -- FIXME CAST(null AS cardinal_number) AS increment, -- FIXME
CAST(null AS character_data) AS cycle_option -- FIXME CAST(null AS yes_or_no) AS cycle_option -- FIXME
FROM pg_namespace nc, pg_class c FROM pg_namespace nc, pg_class c
WHERE c.relnamespace = nc.oid WHERE c.relnamespace = nc.oid
AND c.relkind = 'S' AND c.relkind = 'S'
...@@ -1561,7 +1569,7 @@ GRANT SELECT ON sequences TO PUBLIC; ...@@ -1561,7 +1569,7 @@ GRANT SELECT ON sequences TO PUBLIC;
/* /*
* 5.51 * 5.52
* SQL_FEATURES table * SQL_FEATURES table
*/ */
...@@ -1570,7 +1578,7 @@ CREATE TABLE sql_features ( ...@@ -1570,7 +1578,7 @@ CREATE TABLE sql_features (
feature_name character_data, feature_name character_data,
sub_feature_id character_data, sub_feature_id character_data,
sub_feature_name character_data, sub_feature_name character_data,
is_supported character_data, is_supported yes_or_no,
is_verified_by character_data, is_verified_by character_data,
comments character_data comments character_data
) WITHOUT OIDS; ) WITHOUT OIDS;
...@@ -1581,12 +1589,12 @@ GRANT SELECT ON sql_features TO PUBLIC; ...@@ -1581,12 +1589,12 @@ GRANT SELECT ON sql_features TO PUBLIC;
/* /*
* 5.52 * 5.53
* SQL_IMPLEMENTATION_INFO table * SQL_IMPLEMENTATION_INFO table
*/ */
-- Note: Implementation information items are defined in ISO/IEC 9075-3:2003, -- Note: Implementation information items are defined in ISO/IEC 9075-3:2008,
-- clause 7.1. -- clause 9.1.
CREATE TABLE sql_implementation_info ( CREATE TABLE sql_implementation_info (
implementation_info_id character_data, implementation_info_id character_data,
...@@ -1613,8 +1621,8 @@ GRANT SELECT ON sql_implementation_info TO PUBLIC; ...@@ -1613,8 +1621,8 @@ GRANT SELECT ON sql_implementation_info TO PUBLIC;
/* /*
* 5.53
* SQL_LANGUAGES table * SQL_LANGUAGES table
* apparently removed in SQL:2008
*/ */
CREATE TABLE sql_languages ( CREATE TABLE sql_languages (
...@@ -1643,7 +1651,7 @@ GRANT SELECT ON sql_languages TO PUBLIC; ...@@ -1643,7 +1651,7 @@ GRANT SELECT ON sql_languages TO PUBLIC;
CREATE TABLE sql_packages ( CREATE TABLE sql_packages (
feature_id character_data, feature_id character_data,
feature_name character_data, feature_name character_data,
is_supported character_data, is_supported yes_or_no,
is_verified_by character_data, is_verified_by character_data,
comments character_data comments character_data
) WITHOUT OIDS; ) WITHOUT OIDS;
...@@ -1670,7 +1678,7 @@ GRANT SELECT ON sql_packages TO PUBLIC; ...@@ -1670,7 +1678,7 @@ GRANT SELECT ON sql_packages TO PUBLIC;
CREATE TABLE sql_parts ( CREATE TABLE sql_parts (
feature_id character_data, feature_id character_data,
feature_name character_data, feature_name character_data,
is_supported character_data, is_supported yes_or_no,
is_verified_by character_data, is_verified_by character_data,
comments character_data comments character_data
) WITHOUT OIDS; ) WITHOUT OIDS;
...@@ -1691,7 +1699,7 @@ INSERT INTO sql_parts VALUES ('14', 'XML-Related Specifications (SQL/XML)', 'YES ...@@ -1691,7 +1699,7 @@ INSERT INTO sql_parts VALUES ('14', 'XML-Related Specifications (SQL/XML)', 'YES
* SQL_SIZING table * SQL_SIZING table
*/ */
-- Note: Sizing items are defined in ISO/IEC 9075-3:2003, clause 7.2. -- Note: Sizing items are defined in ISO/IEC 9075-3:2008, clause 9.2.
CREATE TABLE sql_sizing ( CREATE TABLE sql_sizing (
sizing_id cardinal_number, sizing_id cardinal_number,
...@@ -1770,9 +1778,9 @@ CREATE VIEW table_constraints AS ...@@ -1770,9 +1778,9 @@ CREATE VIEW table_constraints AS
WHEN 'p' THEN 'PRIMARY KEY' WHEN 'p' THEN 'PRIMARY KEY'
WHEN 'u' THEN 'UNIQUE' END WHEN 'u' THEN 'UNIQUE' END
AS character_data) AS constraint_type, AS character_data) AS constraint_type,
CAST(CASE WHEN c.condeferrable THEN 'YES' ELSE 'NO' END AS character_data) CAST(CASE WHEN c.condeferrable THEN 'YES' ELSE 'NO' END AS yes_or_no)
AS is_deferrable, AS is_deferrable,
CAST(CASE WHEN c.condeferred THEN 'YES' ELSE 'NO' END AS character_data) CAST(CASE WHEN c.condeferred THEN 'YES' ELSE 'NO' END AS yes_or_no)
AS initially_deferred AS initially_deferred
FROM pg_namespace nc, FROM pg_namespace nc,
...@@ -1800,8 +1808,8 @@ CREATE VIEW table_constraints AS ...@@ -1800,8 +1808,8 @@ CREATE VIEW table_constraints AS
CAST(nr.nspname AS sql_identifier) AS table_schema, CAST(nr.nspname AS sql_identifier) AS table_schema,
CAST(r.relname AS sql_identifier) AS table_name, CAST(r.relname AS sql_identifier) AS table_name,
CAST('CHECK' AS character_data) AS constraint_type, CAST('CHECK' AS character_data) AS constraint_type,
CAST('NO' AS character_data) AS is_deferrable, CAST('NO' AS yes_or_no) AS is_deferrable,
CAST('NO' AS character_data) AS initially_deferred CAST('NO' AS yes_or_no) AS initially_deferred
FROM pg_namespace nr, FROM pg_namespace nr,
pg_class r, pg_class r,
...@@ -1848,8 +1856,8 @@ CREATE VIEW table_privileges AS ...@@ -1848,8 +1856,8 @@ CREATE VIEW table_privileges AS
pg_has_role(grantee.oid, c.relowner, 'USAGE') pg_has_role(grantee.oid, c.relowner, 'USAGE')
OR aclcontains(c.relacl, OR aclcontains(c.relacl,
makeaclitem(grantee.oid, u_grantor.oid, pr.type, true)) makeaclitem(grantee.oid, u_grantor.oid, pr.type, true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable, THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable,
CAST('NO' AS character_data) AS with_hierarchy CAST('NO' AS yes_or_no) AS with_hierarchy
FROM pg_class c, FROM pg_class c,
pg_namespace nc, pg_namespace nc,
...@@ -1905,9 +1913,9 @@ CREATE VIEW tables AS ...@@ -1905,9 +1913,9 @@ CREATE VIEW tables AS
CAST(CASE WHEN c.relkind = 'r' CAST(CASE WHEN c.relkind = 'r'
OR (c.relkind = 'v' OR (c.relkind = 'v'
AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead)) AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_insertable_into, THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_insertable_into,
CAST('NO' AS character_data) AS is_typed, CAST('NO' AS yes_or_no) AS is_typed,
CAST( CAST(
CASE WHEN nc.oid = pg_my_temp_schema() THEN 'PRESERVE' -- FIXME CASE WHEN nc.oid = pg_my_temp_schema() THEN 'PRESERVE' -- FIXME
ELSE null END ELSE null END
...@@ -2067,7 +2075,7 @@ CREATE VIEW usage_privileges AS ...@@ -2067,7 +2075,7 @@ CREATE VIEW usage_privileges AS
CAST(t.typname AS sql_identifier) AS object_name, CAST(t.typname AS sql_identifier) AS object_name,
CAST('DOMAIN' AS character_data) AS object_type, CAST('DOMAIN' AS character_data) AS object_type,
CAST('USAGE' AS character_data) AS privilege_type, CAST('USAGE' AS character_data) AS privilege_type,
CAST('NO' AS character_data) AS is_grantable CAST('NO' AS yes_or_no) AS is_grantable
FROM pg_authid u, FROM pg_authid u,
pg_namespace n, pg_namespace n,
...@@ -2093,7 +2101,7 @@ CREATE VIEW usage_privileges AS ...@@ -2093,7 +2101,7 @@ CREATE VIEW usage_privileges AS
pg_has_role(grantee.oid, fdw.fdwowner, 'USAGE') pg_has_role(grantee.oid, fdw.fdwowner, 'USAGE')
OR aclcontains(fdw.fdwacl, OR aclcontains(fdw.fdwacl,
makeaclitem(grantee.oid, u_grantor.oid, 'USAGE', true)) makeaclitem(grantee.oid, u_grantor.oid, 'USAGE', true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable
FROM pg_foreign_data_wrapper fdw, FROM pg_foreign_data_wrapper fdw,
pg_authid u_grantor, pg_authid u_grantor,
...@@ -2125,7 +2133,7 @@ CREATE VIEW usage_privileges AS ...@@ -2125,7 +2133,7 @@ CREATE VIEW usage_privileges AS
pg_has_role(grantee.oid, srv.srvowner, 'USAGE') pg_has_role(grantee.oid, srv.srvowner, 'USAGE')
OR aclcontains(srv.srvacl, OR aclcontains(srv.srvacl,
makeaclitem(grantee.oid, u_grantor.oid, 'USAGE', true)) makeaclitem(grantee.oid, u_grantor.oid, 'USAGE', true))
THEN 'YES' ELSE 'NO' END AS character_data) AS is_grantable THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable
FROM pg_foreign_server srv, FROM pg_foreign_server srv,
pg_authid u_grantor, pg_authid u_grantor,
...@@ -2281,12 +2289,16 @@ CREATE VIEW views AS ...@@ -2281,12 +2289,16 @@ CREATE VIEW views AS
CASE WHEN EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead) CASE WHEN EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead)
AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead) AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead)
THEN 'YES' ELSE 'NO' END THEN 'YES' ELSE 'NO' END
AS character_data) AS is_updatable, AS yes_or_no) AS is_updatable,
CAST( CAST(
CASE WHEN EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead) CASE WHEN EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead)
THEN 'YES' ELSE 'NO' END THEN 'YES' ELSE 'NO' END
AS character_data) AS is_insertable_into AS yes_or_no) AS is_insertable_into,
CAST('NO' AS yes_or_no) AS is_trigger_updatable,
CAST('NO' AS yes_or_no) AS is_trigger_deletable,
CAST('NO' AS yes_or_no) AS is_trigger_insertable_into
FROM pg_namespace nc, pg_class c FROM pg_namespace nc, pg_class c
...@@ -2303,7 +2315,7 @@ GRANT SELECT ON views TO PUBLIC; ...@@ -2303,7 +2315,7 @@ GRANT SELECT ON views TO PUBLIC;
-- The following views have dependencies that force them to appear out of order. -- The following views have dependencies that force them to appear out of order.
/* /*
* 5.23 * 5.24
* DATA_TYPE_PRIVILEGES view * DATA_TYPE_PRIVILEGES view
*/ */
...@@ -2331,7 +2343,7 @@ GRANT SELECT ON data_type_privileges TO PUBLIC; ...@@ -2331,7 +2343,7 @@ GRANT SELECT ON data_type_privileges TO PUBLIC;
/* /*
* 5.28 * 5.29
* ELEMENT_TYPES view * ELEMENT_TYPES view
*/ */
......
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