Commit f89c972a authored by Peter Eisentraut's avatar Peter Eisentraut

Add documentation for information schema, and some corrections on some

views.
parent 6d7ff848
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/filelist.sgml,v 1.28 2003/04/10 01:22:44 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/filelist.sgml,v 1.29 2003/05/18 20:55:56 petere Exp $ -->
<!entity history SYSTEM "history.sgml"> <!entity history SYSTEM "history.sgml">
<!entity info SYSTEM "info.sgml"> <!entity info SYSTEM "info.sgml">
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
<!entity func-ref SYSTEM "func-ref.sgml"> <!entity func-ref SYSTEM "func-ref.sgml">
<!entity gist SYSTEM "gist.sgml"> <!entity gist SYSTEM "gist.sgml">
<!entity indexcost SYSTEM "indexcost.sgml"> <!entity indexcost SYSTEM "indexcost.sgml">
<!entity infoschema SYSTEM "information_schema.sgml">
<!entity jdbc SYSTEM "jdbc.sgml"> <!entity jdbc SYSTEM "jdbc.sgml">
<!entity libpgeasy SYSTEM "libpgeasy.sgml"> <!entity libpgeasy SYSTEM "libpgeasy.sgml">
<!entity libpq SYSTEM "libpq.sgml"> <!entity libpq SYSTEM "libpq.sgml">
......
This diff is collapsed.
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/postgres.sgml,v 1.51 2003/04/13 09:57:35 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/postgres.sgml,v 1.52 2003/05/18 20:55:56 petere Exp $
--> -->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [ <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
...@@ -189,6 +189,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/postgres.sgml,v 1.51 2003/04/13 09:57:35 pe ...@@ -189,6 +189,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/postgres.sgml,v 1.51 2003/04/13 09:57:35 pe
&ecpg; &ecpg;
&jdbc; &jdbc;
&pygresql; &pygresql;
&infoschema;
</part> </part>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* *
* Copyright 2002, PostgreSQL Global Development Group * Copyright 2002, PostgreSQL Global Development Group
* *
* $Id: information_schema.sql,v 1.4 2003/03/20 05:06:55 momjian Exp $ * $Id: information_schema.sql,v 1.5 2003/05/18 20:55:57 petere Exp $
*/ */
...@@ -169,17 +169,28 @@ CREATE VIEW columns AS ...@@ -169,17 +169,28 @@ CREATE VIEW columns AS
AS character_octet_length, AS character_octet_length,
CAST( CAST(
CASE WHEN a.atttypid IN (1700) THEN ((a.atttypmod - 4) >> 16) & 65535 ELSE null END CASE a.atttypid
WHEN 21 /*int2*/ THEN 16
WHEN 23 /*int4*/ THEN 32
WHEN 20 /*int8*/ THEN 64
WHEN 1700 /*numeric*/ THEN ((a.atttypmod - 4) >> 16) & 65535
WHEN 700 /*float4*/ THEN 24 /*FLT_MANT_DIG*/
WHEN 701 /*float8*/ THEN 53 /*DBL_MANT_DIG*/
ELSE null END
AS cardinal_number) AS cardinal_number)
AS numeric_precision, AS numeric_precision,
CAST( CAST(
CASE WHEN a.atttypid IN (1700) THEN 10 ELSE null END CASE WHEN a.atttypid IN (21, 23, 20, 700, 701) THEN 2
WHEN a.atttypid IN (1700) THEN 10
ELSE null END
AS cardinal_number) AS cardinal_number)
AS numeric_precision_radix, AS numeric_precision_radix,
CAST( CAST(
CASE WHEN a.atttypid IN (1700) THEN (a.atttypmod - 4) & 65535 ELSE null END CASE WHEN a.atttypid IN (21, 23, 20) THEN 0
WHEN a.atttypid IN (1700) THEN (a.atttypmod - 4) & 65535
ELSE null END
AS cardinal_number) AS cardinal_number)
AS numeric_scale, AS numeric_scale,
...@@ -203,18 +214,18 @@ CREATE VIEW columns AS ...@@ -203,18 +214,18 @@ CREATE VIEW columns AS
CAST(null AS sql_identifier) AS collation_schema, CAST(null AS sql_identifier) AS collation_schema,
CAST(null AS sql_identifier) AS collation_name, CAST(null AS sql_identifier) AS collation_name,
CAST(CASE WHEN t.typbasetype <> 0 THEN current_database() ELSE null END CAST(CASE WHEN t.typtype = 'd' THEN current_database() ELSE null END
AS sql_identifier) AS domain_catalog, AS sql_identifier) AS domain_catalog,
CAST(CASE WHEN t.typbasetype <> 0 THEN nt.nspname ELSE null END CAST(CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE null END
AS sql_identifier) AS domain_schema, AS sql_identifier) AS domain_schema,
CAST(CASE WHEN t.typbasetype <> 0 THEN t.typname ELSE null END CAST(CASE WHEN t.typtype = 'd' THEN t.typname ELSE null END
AS sql_identifier) AS domain_name, AS sql_identifier) AS domain_name,
CAST(CASE WHEN t.typbasetype = 0 THEN current_database() ELSE null END CAST(CASE WHEN t.typtype <> 'd' THEN current_database() ELSE null END
AS sql_identifier) AS udt_catalog, AS sql_identifier) AS udt_catalog,
CAST(CASE WHEN t.typbasetype = 0 THEN nt.nspname ELSE null END CAST(CASE WHEN t.typtype <> 'd' THEN nt.nspname ELSE null END
AS sql_identifier) AS udt_schema, AS sql_identifier) AS udt_schema,
CAST(CASE WHEN t.typbasetype = 0 THEN t.typname ELSE null END CAST(CASE WHEN t.typtype <> 'd' THEN t.typname ELSE null END
AS sql_identifier) AS udt_name, AS sql_identifier) AS udt_name,
CAST(null AS sql_identifier) AS scope_catalog, CAST(null AS sql_identifier) AS scope_catalog,
...@@ -298,17 +309,28 @@ CREATE VIEW domains AS ...@@ -298,17 +309,28 @@ CREATE VIEW domains AS
CAST(null AS sql_identifier) AS collation_name, CAST(null AS sql_identifier) AS collation_name,
CAST( CAST(
CASE WHEN t.typbasetype IN (1700) THEN ((t.typtypmod - 4) >> 16) & 65535 ELSE null END CASE t.typbasetype
WHEN 21 /*int2*/ THEN 16
WHEN 23 /*int4*/ THEN 32
WHEN 20 /*int8*/ THEN 64
WHEN 1700 /*numeric*/ THEN ((t.typtypmod - 4) >> 16) & 65535
WHEN 700 /*float4*/ THEN 24 /*FLT_MANT_DIG*/
WHEN 701 /*float8*/ THEN 53 /*DBL_MANT_DIG*/
ELSE null END
AS cardinal_number) AS cardinal_number)
AS numeric_precision, AS numeric_precision,
CAST( CAST(
CASE WHEN t.typbasetype IN (1700) THEN 10 ELSE null END CASE WHEN t.typbasetype IN (21, 23, 20, 700, 701) THEN 2
WHEN t.typbasetype IN (1700) THEN 10
ELSE null END
AS cardinal_number) AS cardinal_number)
AS numeric_precision_radix, AS numeric_precision_radix,
CAST( CAST(
CASE WHEN t.typbasetype IN (1700) THEN (t.typtypmod - 4) & 65535 ELSE null END CASE WHEN t.typbasetype IN (21, 23, 20) THEN 0
WHEN t.typbasetype IN (1700) THEN (t.typtypmod - 4) & 65535
ELSE null END
AS cardinal_number) AS cardinal_number)
AS numeric_scale, AS numeric_scale,
...@@ -347,11 +369,11 @@ CREATE VIEW domains AS ...@@ -347,11 +369,11 @@ CREATE VIEW domains AS
WHERE rs.oid = t.typnamespace WHERE rs.oid = t.typnamespace
AND t.typtype = 'd' AND t.typtype = 'd'
AND t.typowner = u.usesysid AND t.typowner = u.usesysid
AND (u.usename = CURRENT_USER AND (u.usename = current_user
OR EXISTS (SELECT 1 OR EXISTS (SELECT 1
FROM pg_user AS u2 FROM pg_user AS u2
WHERE rs.nspowner = u2.usesysid WHERE rs.nspowner = u2.usesysid
AND u2.usename = CURRENT_USER) AND u2.usename = current_user)
OR EXISTS (SELECT 1 OR EXISTS (SELECT 1
FROM pg_user AS u3, FROM pg_user AS u3,
pg_attribute AS a3, pg_attribute AS a3,
......
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