Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc446509

Browse files
committed
Second pass over run-time configuration system. Adjust priorities on some
option settings. Sort out SIGHUP vs BACKEND -- there is no total orderinghere, so make explicit checks. Add comments explaining all of this.Removed permissions check on SHOW command.Add examine_subclass to the game, rename to SQL_inheritance to fit theofficial data model better. Adjust documentation.Standalone backend needs to reset all options before it starts. Tofacilitate that, have IsUnderPostmaster be set by the postmaster itself,don't wait for the magic -p switch.Also make sure that all environment variables and argv's surviveinit_ps_display(). Use strdup where necessary.Have initdb make configuration files (postgresql.conf, pg_hba.conf) mode0600 -- having configuration files is no fun if you can't edit them.
1 parentbc06269 commitc446509

File tree

13 files changed

+231
-182
lines changed

13 files changed

+231
-182
lines changed

‎doc/src/sgml/advanced.sgml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.14 2000/06/14 13:12:52 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.15 2000/06/22 22:31:15 petere Exp $
33
-->
44

55
<chapter id="advanced">
@@ -116,22 +116,25 @@ SELECT name, altitude
116116
support this <quote>ONLY</quote> notation.
117117
</para>
118118

119-
<para>
120-
Deprecated: In previous versions of postgres, the default was not to
121-
get access to child classes. By experience this was found to be error
122-
prone. Under the old syntax, to get the sub-classes you append "*"
123-
to the table name. For example
124-
125-
<programlisting>
119+
<note>
120+
<title>Deprecated</title>
121+
<para>
122+
In previous versions of <productname>Postgres</productname>, the
123+
default was not to get access to child tables. This was found to
124+
be error prone and is also in violation of SQL. Under the old
125+
syntax, to get the sub-classes you append "*" to the table name.
126+
For example
127+
<programlisting>
126128
SELECT * from cities*;
127-
</programlisting>
128-
129-
This old behaviour is still available by using a SET command:
130-
131-
<programlisting>
132-
SET EXAMINE_SUBCLASS TO on;
133-
</programlisting>
134-
</para>
129+
</programlisting>
130+
To get the old behavior, the set configuration option
131+
<literal>SQL_Inheritance</literal> to off, e.g.,
132+
<programlisting>
133+
SET SQL_Inheritance TO OFF;
134+
</programlisting>
135+
or add a line in your <filename>postgresql.conf</filename> file.
136+
</para>
137+
</note>
135138
</sect1>
136139

137140
<sect1>

‎doc/src/sgml/inherit.sgml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/inherit.sgml,v 1.9 2000/06/14 13:12:52 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/inherit.sgml,v 1.10 2000/06/22 22:31:15 petere Exp $
33
-->
44

55
<chapter id="inherit">
@@ -96,19 +96,25 @@ CREATE TABLE capitals UNDER cities (
9696
<command>UPDATE</command> and <command>DELETE</command> --
9797
support this <quote>ONLY</quote> notation.
9898
</para>
99-
<para>
100-
Deprecated: In previous versions of postgres, the default was not to
101-
get access to child classes. By experience this was found to be error
102-
prone. Under the old syntax, to get the sub-classes you append "*"
103-
to the table name. For example
104-
<programlisting>
105-
SELECT * from cities*;
106-
</programlisting>
107-
This old behaviour is still available by using a SET command...
108-
<programlisting>
109-
SET EXAMINE_SUBCLASS TO on;
110-
</programlisting>
111-
</para>
99+
<note>
100+
<title>Deprecated</title>
101+
<para>
102+
In previous versions of <productname>Postgres</productname>, the
103+
default was not to get access to child tables. This was found to
104+
be error prone and is also in violation of SQL. Under the old
105+
syntax, to get the sub-classes you append "*" to the table name.
106+
For example
107+
<programlisting>
108+
SELECT * from cities*;
109+
</programlisting>
110+
To get the old behavior, the set configuration option
111+
<literal>SQL_Inheritance</literal> to off, e.g.,
112+
<programlisting>
113+
SET SQL_Inheritance TO OFF;
114+
</programlisting>
115+
or add a line in your <filename>postgresql.conf</filename> file.
116+
</para>
117+
</note>
112118
</chapter>
113119

114120
<!-- Keep this comment at the end of the file

‎doc/src/sgml/ref/select.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/select.sgml,v 1.29 2000/06/09 01:44:00 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/select.sgml,v 1.30 2000/06/22 22:31:16 petere Exp $
33
Postgres documentation
44
-->
55

@@ -208,7 +208,7 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="PARAMETER">expression</replac
208208
This was previously the default result, and getting subclasses was
209209
obtained by appending <command>*</command> to the table name.
210210
The old behaviour is available via the command
211-
<command>SETEXAMINE_SUBCLASS TO'on';</command>
211+
<command>SETSQL_Inheritance TOOFF;</command>
212212
</para>
213213

214214
<para>

‎doc/src/sgml/runtime.sgml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.11 2000/06/18 21:24:51 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.12 2000/06/22 22:31:15 petere Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -914,6 +914,23 @@ env PGOPTIONS='--geqo=off' psql
914914
</para>
915915
</listitem>
916916
</varlistentry>
917+
918+
<varlistentry>
919+
<term>SQL_INHERITANCE (<type>bool</type>)</term>
920+
<listitem>
921+
<para>
922+
This controls the inheritance semantics, in particular whether
923+
subtables are included into the consideration of various
924+
commands by default. This was not the case in versions prior
925+
to 7.1. If you need this behaviour you can set this variable
926+
to off, but in the long run you are encouraged to change your
927+
applications to use the <literal>ONLY</literal> keyword to
928+
exclude subtables. See the SQL language reference and the
929+
<citetitle>User's Guide</citetitle> for more information about
930+
inheritance.
931+
</para>
932+
</listitem>
933+
</varlistentry>
917934
</variablelist>
918935
</para>
919936
</sect2>

‎src/backend/bootstrap/bootstrap.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.86 2000/06/17 23:41:27 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.87 2000/06/22 22:31:17 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -35,6 +35,7 @@
3535
#include"tcop/tcopprot.h"
3636
#include"utils/builtins.h"
3737
#include"utils/fmgroids.h"
38+
#include"utils/guc.h"
3839
#include"utils/lsyscache.h"
3940
#include"utils/portal.h"
4041

@@ -248,8 +249,11 @@ BootstrapMain(int argc, char *argv[])
248249
Quiet= false;
249250
Noversion= false;
250251
dbName=NULL;
251-
DataDir=getenv("PGDATA");/* Null if no PGDATA variable */
252-
IsUnderPostmaster= false;
252+
if (!IsUnderPostmaster)
253+
{
254+
ResetAllOptions();
255+
DataDir=getenv("PGDATA");/* Null if no PGDATA variable */
256+
}
253257

254258
while ((flag=getopt(argc,argv,"D:dCQxpB:F"))!=EOF)
255259
{
@@ -275,7 +279,7 @@ BootstrapMain(int argc, char *argv[])
275279
xloginit= true;
276280
break;
277281
case'p':
278-
IsUnderPostmaster= true;
282+
/* indicates fork from postmaster */
279283
break;
280284
case'B':
281285
NBuffers=atoi(optarg);

‎src/backend/commands/variable.c

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.37 2000/06/14 18:17:25 petere Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.38 2000/06/22 22:31:17 petere Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -49,12 +49,7 @@ static bool parse_XactIsoLevel(char *);
4949
staticboolparse_random_seed(char*);
5050
staticboolshow_random_seed(void);
5151
staticboolreset_random_seed(void);
52-
staticboolparse_examine_subclass(char*);
53-
staticboolshow_examine_subclass(void);
54-
staticboolreset_examine_subclass(void);
5552

56-
#defineexamine_subclass_default true
57-
boolexamine_subclass=examine_subclass_default;
5853

5954
/*
6055
* get_token
@@ -169,44 +164,6 @@ get_token(char **tok, char **val, char *str)
169164
returnstr;
170165
}
171166

172-
/*
173-
*
174-
* EXAMINE_SUBCLASS
175-
*
176-
*/
177-
#defineEXAMINE_SUBCLASS "EXAMINE_SUBCLASS"
178-
179-
staticbool
180-
parse_examine_subclass(char*value)
181-
{
182-
if (strcasecmp(value,"on")==0)
183-
examine_subclass= true;
184-
elseif (strcasecmp(value,"off")==0)
185-
examine_subclass= false;
186-
elseif (strcasecmp(value,"default")==0)
187-
examine_subclass=examine_subclass_default;
188-
else
189-
elog(ERROR,"Bad value for %s (%s)",EXAMINE_SUBCLASS,value);
190-
return TRUE;
191-
}
192-
193-
staticbool
194-
show_examine_subclass()
195-
{
196-
197-
if (examine_subclass)
198-
elog(NOTICE,"%s is ON",EXAMINE_SUBCLASS);
199-
else
200-
elog(NOTICE,"%s is OFF",EXAMINE_SUBCLASS);
201-
return TRUE;
202-
}
203-
204-
staticbool
205-
reset_examine_subclass(void)
206-
{
207-
examine_subclass=examine_subclass_default;
208-
return TRUE;
209-
}
210167

211168
/*
212169
* DATE_STYLE
@@ -571,7 +528,7 @@ void
571528
SetPGVariable(constchar*name,constchar*value)
572529
{
573530
/*
574-
* Special cases ought to be removedare handled separately
531+
* Special cases ought to be removedand handled separately
575532
* by TCOP
576533
*/
577534
if (strcasecmp(name,"datestyle")==0)
@@ -588,8 +545,6 @@ SetPGVariable(const char *name, const char *value)
588545
#endif
589546
elseif (strcasecmp(name, "random_seed")==0)
590547
parse_random_seed(pstrdup(value));
591-
elseif (strcasecmp(name, "examine_subclass")==0)
592-
parse_examine_subclass(pstrdup(value));
593548
else
594549
SetConfigOption(name,value,superuser() ?PGC_SUSET :PGC_USERSET);
595550
}
@@ -612,12 +567,10 @@ GetPGVariable(const char *name)
612567
#endif
613568
elseif (strcasecmp(name, "random_seed")==0)
614569
show_random_seed();
615-
elseif (strcasecmp(name, "examine_subclass")==0)
616-
show_examine_subclass();
617570
else
618571
{
619-
constchar*val=GetConfigOption(name,superuser());
620-
elog(NOTICE,"%s= %s",name,val);
572+
constchar*val=GetConfigOption(name);
573+
elog(NOTICE,"%sis %s",name,val);
621574
}
622575
}
623576

@@ -638,8 +591,6 @@ ResetPGVariable(const char *name)
638591
#endif
639592
elseif (strcasecmp(name, "random_seed")==0)
640593
reset_random_seed();
641-
elseif (strcasecmp(name, "examine_subclass")==0)
642-
reset_examine_subclass();
643594
else
644595
SetConfigOption(name,NULL,superuser() ?PGC_SUSET :PGC_USERSET);
645596
}

‎src/backend/parser/gram.y

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.173 2000/06/12 19:40:40 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.174 2000/06/22 22:31:18 petere Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -49,7 +49,7 @@
4949
#include"storage/lmgr.h"
5050
#include"utils/acl.h"
5151
#include"utils/numeric.h"
52-
#include"commands/variable.h"
52+
#include"utils/guc.h"
5353

5454
#ifdef MULTIBYTE
5555
#include"miscadmin.h"
@@ -884,7 +884,7 @@ AlterTableStmt:
884884
AlterTableStmt *n = makeNode(AlterTableStmt);
885885
n->subtype ='A';
886886
n->relname =$3;
887-
n->inh =$4 ||examine_subclass;
887+
n->inh =$4 ||SQL_inheritance;
888888
n->def =$7;
889889
$$ = (Node *)n;
890890
}
@@ -894,7 +894,7 @@ AlterTableStmt:
894894
AlterTableStmt *n = makeNode(AlterTableStmt);
895895
n->subtype ='T';
896896
n->relname =$3;
897-
n->inh =$4 ||examine_subclass;
897+
n->inh =$4 ||SQL_inheritance;
898898
n->name =$7;
899899
n->def =$8;
900900
$$ = (Node *)n;
@@ -905,7 +905,7 @@ AlterTableStmt:
905905
AlterTableStmt *n = makeNode(AlterTableStmt);
906906
n->subtype ='D';
907907
n->relname =$3;
908-
n->inh =$4 ||examine_subclass;
908+
n->inh =$4 ||SQL_inheritance;
909909
n->name =$7;
910910
n->behavior =$8;
911911
$$ = (Node *)n;
@@ -916,7 +916,7 @@ AlterTableStmt:
916916
AlterTableStmt *n = makeNode(AlterTableStmt);
917917
n->subtype ='C';
918918
n->relname =$3;
919-
n->inh =$4 ||examine_subclass;
919+
n->inh =$4 ||SQL_inheritance;
920920
n->def =$6;
921921
$$ = (Node *)n;
922922
}
@@ -926,7 +926,7 @@ AlterTableStmt:
926926
AlterTableStmt *n = makeNode(AlterTableStmt);
927927
n->subtype ='X';
928928
n->relname =$3;
929-
n->inh =$4 ||examine_subclass;
929+
n->inh =$4 ||SQL_inheritance;
930930
n->name =$7;
931931
n->behavior =$8;
932932
$$ = (Node *)n;
@@ -2562,7 +2562,7 @@ RenameStmt: ALTER TABLE relation_name opt_inh_star
25622562
{
25632563
RenameStmt *n = makeNode(RenameStmt);
25642564
n->relname =$3;
2565-
n->inh =$4 ||examine_subclass;
2565+
n->inh =$4 ||SQL_inheritance;
25662566
n->column =$7;
25672567
n->newname =$9;
25682568
$$ = (Node *)n;
@@ -3806,7 +3806,7 @@ relation_expr:relation_name
38063806
/* default inheritance*/
38073807
$$ = makeNode(RelExpr);
38083808
$$->relname =$1;
3809-
$$->inh =examine_subclass;
3809+
$$->inh =SQL_inheritance;
38103810
}
38113811
|relation_name'*' %prec'='
38123812
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp