|
27 | 27 | # Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
28 | 28 | # Portions Copyright (c) 1994, Regents of the University of California
|
29 | 29 | #
|
30 |
| -# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.126 2001/06/12 05:55:50 tgl Exp $ |
| 30 | +# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.127 2001/06/14 19:47:25 tgl Exp $ |
31 | 31 | #
|
32 | 32 | #-------------------------------------------------------------------------
|
33 | 33 |
|
@@ -497,7 +497,8 @@ echo "CREATE TRIGGER pg_sync_pg_pwd AFTER INSERT OR UPDATE OR DELETE ON pg_shado
|
497 | 497 | "FOR EACH ROW EXECUTE PROCEDURE update_pg_pwd()" \
|
498 | 498 | |"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
|
499 | 499 |
|
500 |
| -# needs to be done before alter user |
| 500 | +# needs to be done before alter user, because alter user checks that |
| 501 | +# pg_shadow is secure ... |
501 | 502 | echo"REVOKE ALL on pg_shadow FROM public" \
|
502 | 503 | |"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
|
503 | 504 |
|
@@ -601,6 +602,46 @@ echo "CREATE VIEW pg_indexes AS \
|
601 | 602 | AND I.oid = X.indexrelid;" \
|
602 | 603 | |"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
|
603 | 604 |
|
| 605 | +echo"CREATE VIEW pg_stats AS\ |
| 606 | +SELECT\ |
| 607 | + relname AS tablename,\ |
| 608 | + attname AS attname,\ |
| 609 | + stanullfrac AS null_frac,\ |
| 610 | + stawidth AS avg_width,\ |
| 611 | + stadistinct AS n_distinct,\ |
| 612 | + CASE 1\ |
| 613 | +WHEN stakind1 THEN stavalues1\ |
| 614 | +WHEN stakind2 THEN stavalues2\ |
| 615 | +WHEN stakind3 THEN stavalues3\ |
| 616 | +WHEN stakind4 THEN stavalues4\ |
| 617 | + END AS most_common_vals,\ |
| 618 | + CASE 1\ |
| 619 | +WHEN stakind1 THEN stanumbers1\ |
| 620 | +WHEN stakind2 THEN stanumbers2\ |
| 621 | +WHEN stakind3 THEN stanumbers3\ |
| 622 | +WHEN stakind4 THEN stanumbers4\ |
| 623 | + END AS most_common_freqs,\ |
| 624 | + CASE 2\ |
| 625 | +WHEN stakind1 THEN stavalues1\ |
| 626 | +WHEN stakind2 THEN stavalues2\ |
| 627 | +WHEN stakind3 THEN stavalues3\ |
| 628 | +WHEN stakind4 THEN stavalues4\ |
| 629 | + END AS histogram_bounds,\ |
| 630 | + CASE 3\ |
| 631 | +WHEN stakind1 THEN stanumbers1[1]\ |
| 632 | +WHEN stakind2 THEN stanumbers2[1]\ |
| 633 | +WHEN stakind3 THEN stanumbers3[1]\ |
| 634 | +WHEN stakind4 THEN stanumbers4[1]\ |
| 635 | + END AS correlation\ |
| 636 | +FROM pg_class c, pg_attribute a, pg_statistic s\ |
| 637 | +WHERE c.oid = s.starelid AND c.oid = a.attrelid\ |
| 638 | + AND a.attnum = s.staattnum\ |
| 639 | + AND has_table_privilege(c.oid, 'select');" \ |
| 640 | +|"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely |
| 641 | + |
| 642 | +echo"REVOKE ALL on pg_statistic FROM public" \ |
| 643 | +|"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely |
| 644 | + |
604 | 645 | echo"Loading pg_description."
|
605 | 646 | echo"COPY pg_description FROM STDIN">$TEMPFILE
|
606 | 647 | cat"$POSTGRES_DESCR">>$TEMPFILE
|
|