Commit Graph

105 Commits

Author SHA1 Message Date
Tatsuo Ishii d596736a49 Doc: fix character_sets view.
The note regarding character encoding form in "The Information Schema"
said that LATIN1 character repertoires only use one encoding form
LATIN1. This is not correct because LATIN1 has another encoding form
ISO-2022-JP-2. To fix this, replace LATIN1 with LATIN2, which is not
supported by ISO-2022-JP-2, thus it can be said that LATIN2 only uses
one encoding form.

Back-patch to supported branches.

Author: Tatsuo Ishii
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/flat/20240102.153925.1147403616414525145.t-ishii%40sranhm.sra.co.jp
2024-01-09 19:43:19 +09:00
Peter Eisentraut 5b2dcead39 doc: Update info on information schema usage tables
Commit f40c6969d0 added the information schema usage tables but added
documentation that they did not fully work yet.  Commit e717a9a18b
then added SQL-standard function bodies, which made the information
schema views fully functional, but it neglected to update the
documentation.  This is now done here.

Reported-by: Erki Eessaar <erki.eessaar@taltech.ee>
Reviewed-by: Erki Eessaar <erki.eessaar@taltech.ee>
Discussion: https://www.postgresql.org/message-id/flat/AM9PR01MB8268EC7B696F9FE346CA5B93FEB8A%40AM9PR01MB8268.eurprd01.prod.exchangelabs.com
2023-12-01 08:41:41 +01:00
Peter Eisentraut af2324fabf doc: Clarify not-null constraints in information schema
Add a bit of clarification in various places that not-null constraints
are included under check constraints in the information schema.
2023-10-04 15:03:48 +02:00
Peter Eisentraut 78806a9509 Remove incorrect field from information schema
The source code comment already said that the presence of the field
element_types.domain_default might be a bug in the standard, since it
never made sense there.  Indeed, the field is gone in newer versions
of the standard.  So just remove it.
2023-08-16 13:46:26 +02:00
Peter Eisentraut 94aa7cc5f7 Add UNIQUE null treatment option
The SQL standard has been ambiguous about whether null values in
unique constraints should be considered equal or not.  Different
implementations have different behaviors.  In the SQL:202x draft, this
has been formalized by making this implementation-defined and adding
an option on unique constraint definitions UNIQUE [ NULLS [NOT]
DISTINCT ] to choose a behavior explicitly.

This patch adds this option to PostgreSQL.  The default behavior
remains UNIQUE NULLS DISTINCT.  Making this happen in the btree code
is pretty easy; most of the patch is just to carry the flag around to
all the places that need it.

The CREATE UNIQUE INDEX syntax extension is not from the standard,
it's my own invention.

I named all the internal flags, catalog columns, etc. in the negative
("nulls not distinct") so that the default PostgreSQL behavior is the
default if the flag is false.

Reviewed-by: Maxim Orlov <orlovmg@gmail.com>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/84e5ee1b-387e-9a54-c326-9082674bde78@enterprisedb.com
2022-02-03 11:48:21 +01:00
Tom Lane 3dddb2a821 Doc: add a glossary entry for "domain".
Anton Voloshin and Jürgen Purtz, reviewed by Laurenz Albe

Discussion: https://postgr.es/m/2ea65bdf-1380-f088-02bd-ff1a31ed265c@postgrespro.ru
2021-07-30 14:50:21 -04:00
Peter Eisentraut f40c6969d0 Routine usage information schema tables
Several information schema views track dependencies between
functions/procedures and objects used by them.  These had not been
implemented so far because PostgreSQL doesn't track objects used in a
function body.  However, formally, these also show dependencies used
in parameter default expressions, which PostgreSQL does support and
track.  So for the sake of completeness, we might as well add these.
If dependency tracking for function bodies is ever implemented, these
views will automatically work correctly.

Reviewed-by: Erik Rijkers <er@xs4all.nl>
Discussion: https://www.postgresql.org/message-id/flat/ac80fc74-e387-8950-9a31-2560778fc1e3%40enterprisedb.com
2021-02-17 18:16:06 +01:00
Tom Lane a042750646 Doc: reformat catalog/view description tables.
This changes our catalog and view descriptions to use a style inspired
by the new format for function/operator tables: each table entry is
formatted roughly like a <varlistentry>, with the column name and type
on the first line and then an indented description.  This provides much
more room for expansive descriptions than we had before, and thereby
eliminates a passel of PDF build warnings.

Discussion: https://postgr.es/m/12984.1588643549@sss.pgh.pa.us
2020-05-13 23:03:39 -04:00
Tom Lane 336aa51b70 Doc: marginal hacking to remove some PDF build warnings.
This patch eliminates a few more "exceed the available area" warnings
whose causes aren't particularly connected to anything else.

The only one really worthy of comment is that I increased the space
allowed for an <orderedlist>'s numbers, because the default of 1em
doesn't quite work for more than one digit.  The rest are one-off
insertions of &zwsp; and suchlike tweaks, in places where they
shouldn't do any damage to the material.  (In particular, although
I split some long identifiers with zwsp's, there are other nearby
occurrences of each one; so those changes shouldn't hurt greppability
of the document sources.)
2020-05-10 16:20:28 -04:00
Tom Lane 9356e43544 Doc: fix assorted misstatements of fact in catalog & system view docs.
I made up a very crude hack to compare the docs with reality (as
embodied in the system catalogs) ... and indeed they don't match
everywhere.  Missing oid columns, wrong data types, wrong "references"
links, columns listed in the wrong order.  None of this seems quite
important enough to back-patch.
2020-05-09 19:09:44 -04:00
Peter Eisentraut 2fc2a88e67 Remove obsolete information schema tables
Remove SQL_LANGUAGES, which was eliminated in SQL:2008, and
SQL_PACKAGES and SQL_SIZING_PROFILES, which were eliminated in
SQL:2011.  Since they were dropped by the SQL standard, the
information in them was no longer updated and therefore no longer
useful.

This also removes the feature-package association information in
sql_feature_packages.txt, but for the time begin we are keeping the
information which features are in the Core package (that is, mandatory
SQL features).  Maybe at some point someone wants to invent a way to
store that that does not involve using the "package" mechanism
anymore.

Discussion https://www.postgresql.org/message-id/flat/91334220-7900-071b-9327-0c6ecd012017%402ndquadrant.com
2019-10-25 21:37:14 +02:00
Michael Paquier 0b8e0532c6 Fix documentation of check_option in information_schema.views
Support of CHECK OPTION for updatable views has been added in 9.4, but
the documentation of information_schema never got the call even if the
information displayed is correct.

Author: Gilles Darold
Discussion: https://postgr.es/m/75d07704-6c74-4f26-656a-10045c01a17e@darold.net
Backpatch-through: 9.4
2019-06-01 15:33:47 -04:00
Andres Freund f6b39171f3 docs: cleanup/remove/update references to OID column.
I (Andres) missed these in 578b229718.

Author: Justin Pryzby, editorialized a bit by Andres Freund
Reviewed-By: Daniel Verite, Andres Freund
Discussion: https://postgr.es/m/20190408002847.GA904@telsasoft.com
2019-04-17 17:22:56 -07:00
Peter Eisentraut fc22b6623b Generated columns
This is an SQL-standard feature that allows creating columns that are
computed from expressions rather than assigned, similar to a view or
materialized view but on a column basis.

This implements one kind of generated column: stored (computed on
write).  Another kind, virtual (computed on read), is planned for the
future, and some room is left for it.

Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/b151f851-4019-bdb1-699e-ebab07d2f40a@2ndquadrant.com
2019-03-30 08:15:57 +01:00
Bruce Momjian dcb2efdbdd doc: add doc link for 'applicable_roles'
Reported-by: Ashutosh Sharma

Discussion: https://postgr.es/m/CAE9k0PnhnL6MNDLuvkk8USzOa_DpzDzFQPAM_uaGuXbh9HMKYw@mail.gmail.com

Author: Ashutosh Sharma

Backpatch-through: 9.3
2018-08-25 13:01:24 -04:00
Peter Eisentraut 0a63f996e0 Change PROCEDURE to FUNCTION in CREATE TRIGGER syntax
Since procedures are now a different thing from functions, change the
CREATE TRIGGER and CREATE EVENT TRIGGER syntax to use FUNCTION in the
clause that specifies the function.  PROCEDURE is still accepted for
compatibility.

pg_dump and ruleutils.c output is not changed yet, because that would
require a change in information_schema.sql and thus a catversion change.

Reported-by: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Jonathan S. Katz <jonathan.katz@excoventures.com>
2018-08-22 14:44:49 +02:00
Peter Eisentraut 32ff269117 Add more information_schema columns
- table_constraints.enforced
- triggers.action_order
- triggers.action_reference_old_table
- triggers.action_reference_new_table

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
2018-02-07 10:08:02 -05:00
Peter Eisentraut e4128ee767 SQL procedures
This adds a new object type "procedure" that is similar to a function
but does not have a return type and is invoked by the new CALL statement
instead of SELECT or similar.  This implementation is aligned with the
SQL standard and compatible with or similar to other SQL implementations.

This commit adds new commands CALL, CREATE/ALTER/DROP PROCEDURE, as well
as ALTER/DROP ROUTINE that can refer to either a function or a
procedure (or an aggregate function, as an extension to SQL).  There is
also support for procedures in various utility commands such as COMMENT
and GRANT, as well as support in pg_dump and psql.  Support for defining
procedures is available in all the languages supplied by the core
distribution.

While this commit is mainly syntax sugar around existing functionality,
future features will rely on having procedures as a separate object
type.

Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-11-30 11:03:20 -05:00
Peter Eisentraut 3c49c6facb Convert documentation to DocBook XML
Since some preparation work had already been done, the only source
changes left were changing empty-element tags like <xref linkend="foo">
to <xref linkend="foo"/>, and changing the DOCTYPE.

The source files are still named *.sgml, but they are actually XML files
now.  Renaming could be considered later.

In the build system, the intermediate step to convert from SGML to XML
is removed.  Everything is build straight from the source files again.
The OpenSP (or the old SP) package is no longer needed.

The documentation toolchain instructions are updated and are much
simpler now.

Peter Eisentraut, Alexander Lakhin, Jürgen Purtz
2017-11-23 09:44:28 -05:00
Peter Eisentraut c29c578908 Don't use SGML empty tags
For DocBook XML compatibility, don't use SGML empty tags (</>) anymore,
replace by the full tag name.  Add a warning option to catch future
occurrences.

Alexander Lakhin, Jürgen Purtz
2017-10-17 15:10:33 -04:00
Peter Eisentraut 9b5140fb50 Correct representation of foreign tables in information schema
tables.table_type is supposed to be 'FOREIGN' rather than 'FOREIGN
TABLE' according to the SQL standard.
2017-08-16 11:03:33 -04:00
Peter Eisentraut 5d8beac8be doc: Update information_schema documentation for identity columns
This was apparently forgotten in the original patch.
2017-06-12 16:20:12 -04:00
Peter Eisentraut 3217327053 Identity columns
This is the SQL standard-conforming variant of PostgreSQL's serial
columns.  It fixes a few usability issues that serial columns have:

- CREATE TABLE / LIKE copies default but refers to same sequence
- cannot add/drop serialness with ALTER TABLE
- dropping default does not drop sequence
- need to grant separate privileges to sequence
- other slight weirdnesses because serial is some kind of special macro

Reviewed-by: Vitaly Burovoy <vitaly.burovoy@gmail.com>
2017-04-06 08:41:37 -04:00
Peter Eisentraut 2ea5b06c7a Add CREATE SEQUENCE AS <data type> clause
This stores a data type, required to be an integer type, with the
sequence.  The sequences min and max values default to the range
supported by the type, and they cannot be set to values exceeding that
range.  The internal implementation of the sequence is not affected.

Change the serial types to create sequences of the appropriate type.
This makes sure that the min and max values of the sequence for a serial
column match the range of values supported by the table column.  So the
sequence can no longer overflow the table column.

This also makes monitoring for sequence exhaustion/wraparound easier,
which currently requires various contortions to cross-reference the
sequences with the table columns they are used with.

This commit also effectively reverts the pg_sequence column reordering
in f3b421da5f, because the new seqtypid
column allows us to fill the hole in the struct and create a more
natural overall column ordering.

Reviewed-by: Steve Singer <steve@ssinger.info>
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
2017-02-10 15:34:35 -05:00
Peter Eisentraut 2b8fd4fa67 doc: Remove documentation of nonexistent information schema columns
These were probably copied in by accident.

From: Clément Prévost <prevostclement@gmail.com>
2016-08-03 13:50:13 -04:00
Fujii Masao de8c92e6ca Fix incorrect description of udt_privileges view in documentation.
The description of udt_privileges view contained an incorrect copy-pasted word.

Back-patch to 9.2 where udt_privileges view was added.

Author: Alexander Law
2016-07-28 22:34:42 +09:00
Peter Eisentraut cac7658205 Add transforms feature
This provides a mechanism for specifying conversions between SQL data
types and procedural languages.  As examples, there are transforms
for hstore and ltree for PL/Perl and PL/Python.

reviews by Pavel Stěhule and Andres Freund
2015-04-26 10:33:14 -04:00
Peter Eisentraut 85ed91ee7d Implement information_schema.parameters.parameter_default column
Reviewed-by: Ali Dar <ali.munir.dar@gmail.com>
Reviewed-by: Amit Khandekar <amit.khandekar@enterprisedb.com>
Reviewed-by: Rodolfo Campero <rodolfo.campero@anachronics.com>
2013-11-26 23:21:35 -05:00
Peter Eisentraut b34f8f409b Show schemas in information_schema.schemata that the current has access to
Before, it would only show schemas that the current user owns.  Per
discussion, the new behavior is more useful and consistent for PostgreSQL.
2013-09-09 22:25:37 -04:00
Peter Eisentraut 256f6ba78a Documentation spell checking and markup improvements 2013-05-20 21:13:13 -04:00
Tom Lane 25f4fe4e46 Fix typo in information_schema documentation.
Shigeru Hanada
2012-09-05 23:37:42 -04:00
Peter Eisentraut 82e83f46a2 Add sequence USAGE privileges to information schema
The sequence USAGE privilege is sufficiently similar to the SQL
standard that it seems reasonable to show in the information schema.
Also add some compatibility notes about it on the GRANT reference
page.
2012-01-30 21:45:42 +02:00
Peter Eisentraut 729205571e Add support for privileges on types
This adds support for the more or less SQL-conforming USAGE privilege
on types and domains.  The intent is to be able restrict which users
can create dependencies on types, which restricts the way in which
owners can alter types.

reviewed by Yeb Havinga
2011-12-20 00:05:19 +02:00
Peter Eisentraut 024ea25ccd Small markup and wording improvement 2011-11-22 21:14:53 +02:00
Peter Eisentraut fd5b397ca4 Implement the information schema with_hierarchy column
In PostgreSQL, this is included in the SELECT privilege, so show YES
or NO depending on whether SELECT is granted.
2011-08-27 15:03:02 +03:00
Robert Haas c4096c7639 Allow per-column foreign data wrapper options.
Shigeru Hanada, with fairly minor editing by me.
2011-08-05 13:24:03 -04:00
Peter Eisentraut 3835855589 Note that information_schema.sql_languages was removed in SQL:2008 2011-07-18 07:26:30 +03:00
Peter Eisentraut bf3c585681 Set information_schema.tables.commit_action to null
The commit action of temporary tables is currently not cataloged, so
we can't easily show it.  The previous value was outdated from before
we had different commit actions.
2011-07-15 21:11:14 +03:00
Alvaro Herrera c529f8800e Fix broken markup 2011-07-14 13:43:01 -04:00
Peter Eisentraut f4678c205a Set information_schema.routines.is_udt_dependent to NO
It previously said YES, but that is incorrect.
2011-07-14 19:18:17 +03:00
Peter Eisentraut 0527a454ec Implement information schema interval_type columns
Also correct reporting of interval precision when field restrictions
are specified in the typmod.
2011-07-13 20:32:08 +03:00
Peter Eisentraut 3315020a09 Fix and clarify information schema interval_precision fields
The fields were previously wrongly typed as character_data; change to
cardinal_number.  Update the documentation and the implementation to
show more clearly that this applies to a feature not available in
PostgreSQL, rather than just not yet being implemented in the
information schema.
2011-07-11 18:49:44 +03:00
Peter Eisentraut 6fbc80349f Set user_defined_types.data_type to null
On re-reading the standard, this field is only used for distinct or
reference types.
2011-07-04 23:09:42 +03:00
Peter Eisentraut 615c384972 Implement the collation columns of various information schema views
Fill in the collation columns of the views attributes, columns,
domains, and element_types.  Also update collation information in
sql_implementation_info.
2011-06-28 17:49:28 +03:00
Peter Eisentraut 5594d14696 Add composite-type attributes to information_schema.element_types view 2011-06-28 16:08:52 +03:00
Peter Eisentraut d34e142c51 Add information schema views role_udt_grants, udt_privileges, user_defined_types 2011-06-23 22:12:46 +03:00
Peter Eisentraut 2c262ea9fe Add a bit of markup 2011-06-23 08:04:10 +03:00
Peter Eisentraut 7d43ae6713 Fix documentation of information_schema.element_types
The documentation of the columns collection_type_identifier and
dtd_identifier was wrong.  This effectively reverts commits
8e1ccad519 and
57352df66d and updates the name
array_type_identifier (the name in SQL:1999) to
collection_type_identifier.

closes bug #5926
2011-06-09 07:24:14 +03:00
Peter Eisentraut 3ece3913d0 Truncate id to <=44 characters
This is the original DocBook SGML limit, but apparently most
installations have changed it or ignore it, which is why few people
have run into this problem.

pointed out by Brendan Jurd
2011-06-03 22:25:26 +03:00
Peter Eisentraut 60497722ac Put lists in sensible order 2011-05-22 22:38:53 +03:00