Re: [HACKERS] Patch for initdb - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Patch for initdb
Date
Msg-id 199809091817.OAA11518@candle.pha.pa.us
Whole thread Raw
In response to Patch for initdb  (Keith Parks <emkxp01@mtcc.demon.co.uk>)
List pgsql-hackers
Applied.  Let's see if this fixes the pg_user problem.


> Hi patchers/hackers.
>
> Here's a patch for initdb that does two things.
>
> 1) Encloses the created rulenames in quotes to preserve case
>    in the creation step. (stores _RETpg... instead of _retpg...)
>    I believe _RET is standard for views.
>
> 2) Renames pg_view to pg_views and pg_rule to pg_rules.
>    I believe Jan and myself agreed this would be a "good idea"
>
> Both aspects open for discussion.
>
> Are there any docs considerations?
>
> Keith.

>
Content-Description: initdb.sh.patch

> *** src/bin/initdb/initdb.sh.orig    Thu Sep  3 23:04:10 1998
> --- src/bin/initdb/initdb.sh    Thu Sep  3 23:14:30 1998
> ***************
> *** 425,431 ****
>       postgres $PGSQL_OPT template1 > /dev/null
>   mv $PGDATA/base/template1/xpg_user $PGDATA/base/template1/pg_user
>
> ! echo "CREATE RULE _RETpg_user AS ON SELECT TO pg_user DO INSTEAD    \
>           SELECT usename, usesysid, usecreatedb, usetrace,        \
>                  usesuper, usecatupd, '********'::text as passwd,    \
>              valuntil FROM pg_shadow;" | \
> --- 425,431 ----
>       postgres $PGSQL_OPT template1 > /dev/null
>   mv $PGDATA/base/template1/xpg_user $PGDATA/base/template1/pg_user
>
> ! echo "CREATE RULE \"_RETpg_user\" AS ON SELECT TO pg_user DO INSTEAD    \
>           SELECT usename, usesysid, usecreatedb, usetrace,        \
>                  usesuper, usecatupd, '********'::text as passwd,    \
>              valuntil FROM pg_shadow;" | \
> ***************
> *** 433,465 ****
>   echo "REVOKE ALL on pg_shadow FROM public" | \
>       postgres $PGSQL_OPT template1 > /dev/null
>
> ! echo "Creating view pg_rule"
> ! echo "CREATE TABLE xpg_rule (        \
>           rulename    name,        \
>           definition    text);" | postgres $PGSQL_OPT template1 > /dev/null
> ! #move it into pg_rule
> ! echo "UPDATE pg_class SET relname = 'pg_rule' WHERE relname = 'xpg_rule';" |\
>       postgres $PGSQL_OPT template1 > /dev/null
> ! echo "UPDATE pg_type SET typname = 'pg_rule' WHERE typname = 'xpg_rule';" |\
>       postgres $PGSQL_OPT template1 > /dev/null
> ! mv $PGDATA/base/template1/xpg_rule $PGDATA/base/template1/pg_rule
>
> ! echo "CREATE RULE _RETpg_rule AS ON SELECT TO pg_rule DO INSTEAD    \
>           SELECT rulename, pg_get_ruledef(rulename) AS definition    \
>             FROM pg_rewrite;" | postgres $PGSQL_OPT template1 > /dev/null
>
> ! echo "Creating view pg_view"
> ! echo "CREATE TABLE xpg_view (        \
>           viewname    name,        \
>           definition    text);" | postgres $PGSQL_OPT template1 > /dev/null
> ! #move it into pg_view
> ! echo "UPDATE pg_class SET relname = 'pg_view' WHERE relname = 'xpg_view';" |\
>       postgres $PGSQL_OPT template1 > /dev/null
> ! echo "UPDATE pg_type SET typname = 'pg_view' WHERE typname = 'xpg_view';" |\
>       postgres $PGSQL_OPT template1 > /dev/null
> ! mv $PGDATA/base/template1/xpg_view $PGDATA/base/template1/pg_view
>
> ! echo "CREATE RULE _RETpg_view AS ON SELECT TO pg_view DO INSTEAD    \
>           SELECT relname AS viewname,                 \
>                  pg_get_viewdef(relname) AS definition        \
>             FROM pg_class WHERE relhasrules AND            \
> --- 433,465 ----
>   echo "REVOKE ALL on pg_shadow FROM public" | \
>       postgres $PGSQL_OPT template1 > /dev/null
>
> ! echo "Creating view pg_rules"
> ! echo "CREATE TABLE xpg_rules (        \
>           rulename    name,        \
>           definition    text);" | postgres $PGSQL_OPT template1 > /dev/null
> ! #move it into pg_rules
> ! echo "UPDATE pg_class SET relname = 'pg_rules' WHERE relname = 'xpg_rules';" |\
>       postgres $PGSQL_OPT template1 > /dev/null
> ! echo "UPDATE pg_type SET typname = 'pg_rules' WHERE typname = 'xpg_rules';" |\
>       postgres $PGSQL_OPT template1 > /dev/null
> ! mv $PGDATA/base/template1/xpg_rules $PGDATA/base/template1/pg_rules
>
> ! echo "CREATE RULE \"_RETpg_rules\" AS ON SELECT TO pg_rules DO INSTEAD    \
>           SELECT rulename, pg_get_ruledef(rulename) AS definition    \
>             FROM pg_rewrite;" | postgres $PGSQL_OPT template1 > /dev/null
>
> ! echo "Creating view pg_views"
> ! echo "CREATE TABLE xpg_views (        \
>           viewname    name,        \
>           definition    text);" | postgres $PGSQL_OPT template1 > /dev/null
> ! #move it into pg_views
> ! echo "UPDATE pg_class SET relname = 'pg_views' WHERE relname = 'xpg_views';" |\
>       postgres $PGSQL_OPT template1 > /dev/null
> ! echo "UPDATE pg_type SET typname = 'pg_views' WHERE typname = 'xpg_views';" |\
>       postgres $PGSQL_OPT template1 > /dev/null
> ! mv $PGDATA/base/template1/xpg_views $PGDATA/base/template1/pg_views
>
> ! echo "CREATE RULE \"_RETpg_views\" AS ON SELECT TO pg_views DO INSTEAD    \
>           SELECT relname AS viewname,                 \
>                  pg_get_viewdef(relname) AS definition        \
>             FROM pg_class WHERE relhasrules AND            \


--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Indixing problems...
Next
From: Michael Meskes
Date:
Subject: inx problem fixe