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

Commit92b2c12

Browse files
committed
Merge branch 'PGPRO9_6' into PGPROEE9_6
2 parents4928051 +c2bae10 commit92b2c12

File tree

30 files changed

+537
-150
lines changed

30 files changed

+537
-150
lines changed

‎contrib/pg_arman/Makefile

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,41 @@ OBJS = backup.o \
2323

2424
EXTRA_CLEAN = datapagemap.c datapagemap.h xlogreader.c receivelog.c receivelog.h streamutil.c streamutil.h logging.h
2525

26-
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS}
27-
overrideCPPFLAGS := -DFRONTEND$(CPPFLAGS)
28-
PG_LIBS =$(libpq_pgport) ${PTHREAD_LIBS} ${PTHREAD_CFLAGS}
29-
3026
REGRESS = init option show delete backup restore
3127

3228
all: checksrcdir datapagemap.h logging.h receivelog.h streamutil.h pg_arman
3329

30+
MAKE_GLOBAL="../../src/Makefile.global"
31+
TEST_GLOBAL:=$(shell test -e ../../src/Makefile.global)
32+
ifeq ($(.SHELLSTATUS),1)
33+
PG_CONFIG = pg_config
34+
PGXS :=$(shell$(PG_CONFIG) --pgxs)
35+
include$(PGXS)
36+
37+
.PHONY: checksrcdir
38+
checksrcdir:
39+
ifndeftop_srcdir
40+
@echo "You must have PostgreSQL source tree available to compile."
41+
@echo "Pass the path to the PostgreSQL source tree to make, in the top_srcdir"
42+
@echo "variable: \"make top_srcdir=<path to PostgreSQL source tree>\""
43+
@exit 1
44+
endif
45+
else
46+
#TODO: fix me
47+
REGRESS =
48+
subdir=contrib/pg_arman
49+
top_builddir=../..
50+
include$(top_builddir)/src/Makefile.global
51+
include$(top_srcdir)/contrib/contrib-global.mk
52+
endif
53+
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS}
54+
overrideCPPFLAGS := -DFRONTEND$(CPPFLAGS)$(PG_CPPFLAGS)
55+
PG_LIBS =$(libpq_pgport) ${PTHREAD_CFLAGS}
56+
57+
envtest:
58+
: top_srcdir=$(top_srcdir)
59+
: libpq_srcdir =$(libpq_srcdir)
60+
3461
# This rule's only purpose is to give the user instructions on how to pass
3562
# the path to PostgreSQL source tree to the makefile.
3663
.PHONY: checksrcdir
@@ -61,8 +88,3 @@ streamutil.c: % : $(top_srcdir)/src/bin/pg_basebackup/%
6188
rm -f&&$(LN_S)$<.
6289
streamutil.h:% :$(top_srcdir)/src/bin/pg_basebackup/%
6390
rm -f&&$(LN_S)$<.
64-
65-
PG_CONFIG = pg_config
66-
PGXS :=$(shell$(PG_CONFIG) --pgxs)
67-
include$(PGXS)
68-

‎contrib/pg_arman/backup.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,14 +1108,21 @@ add_files(parray *files, const char *root, bool add_root, bool is_pgdata)
11081108
file->is_datafile= true;
11091109
{
11101110
intfind_dot;
1111+
intcheck_digit;
11111112
char*text_segno;
11121113
for(find_dot=path_len-1;file->path[find_dot]!='.'&&find_dot >=0;find_dot--);
11131114
if (find_dot <=0)
11141115
continue;
11151116

11161117
text_segno=file->path+find_dot+1;
1117-
/* in future we will need check all chars */
1118-
if (!isdigit(text_segno[0]))
1118+
for(check_digit=0;text_segno[check_digit]!='\0';check_digit++)
1119+
if (!isdigit(text_segno[check_digit]))
1120+
{
1121+
check_digit=-1;
1122+
break;
1123+
}
1124+
1125+
if (check_digit==-1)
11191126
continue;
11201127

11211128
file->segno= (int)strtol(text_segno,NULL,10);

‎contrib/pg_arman/data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ restore_data_file(const char *from_root,
519519
if (i==BLCKSZ)
520520
gotoskip_checksum;
521521
}
522-
((PageHeader)page.data)->pd_checksum=pg_checksum_page(page.data,header.block);
522+
((PageHeader)page.data)->pd_checksum=pg_checksum_page(page.data,file->segno*RELSEG_SIZE+header.block);
523523
}
524524

525525
skip_checksum:

‎contrib/pg_arman/dir.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ dir_read_file_list(const char *root, const char *file_txt)
547547
pg_crc32crc;
548548
unsignedintmode;/* bit length of mode_t depends on platforms */
549549
structtmtm;
550-
pgFile*file;
550+
pgFile*file;
551551

552552
memset(&tm,0,sizeof(tm));
553553
if (sscanf(buf,"%s %c %lu %u %o %d-%d-%d %d:%d:%d",
@@ -590,6 +590,30 @@ dir_read_file_list(const char *root, const char *file_txt)
590590
strcpy(file->path,path);
591591

592592
parray_append(files,file);
593+
594+
if(file->is_datafile)
595+
{
596+
intfind_dot;
597+
intcheck_digit;
598+
char*text_segno;
599+
size_tpath_len=strlen(file->path);
600+
for(find_dot=path_len-1;file->path[find_dot]!='.'&&find_dot >=0;find_dot--);
601+
if (find_dot <=0)
602+
continue;
603+
604+
text_segno=file->path+find_dot+1;
605+
for(check_digit=0;text_segno[check_digit]!='\0';check_digit++)
606+
if (!isdigit(text_segno[check_digit]))
607+
{
608+
check_digit=-1;
609+
break;
610+
}
611+
612+
if (check_digit==-1)
613+
continue;
614+
615+
file->segno= (int)strtol(text_segno,NULL,10);
616+
}
593617
}
594618

595619
fclose(fp);

‎doc/src/sgml/config.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2614,7 +2614,7 @@ include_dir 'conf.d'
26142614
<listitem>
26152615
<para>
26162616
Maximum time between automatic WAL checkpoints, in seconds.
2617-
The valid range is between 30 seconds and onehour.
2617+
The valid range is between 30 seconds and oneday.
26182618
The default is five minutes (<literal>5min</>).
26192619
Increasing this parameter can increase the amount of time needed
26202620
for crash recovery.

‎doc/src/sgml/ddl.sgml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,7 @@ CREATE POLICY account_managers ON accounts TO managers
16291629

16301630
<programlisting>
16311631
CREATE POLICY user_policy ON users
1632-
USING (user = current_user);
1632+
USING (user_name = current_user);
16331633
</programlisting>
16341634

16351635
<para>
@@ -1642,7 +1642,7 @@ CREATE POLICY user_policy ON users
16421642
<programlisting>
16431643
CREATE POLICY user_policy ON users
16441644
USING (true)
1645-
WITH CHECK (user = current_user);
1645+
WITH CHECK (user_name = current_user);
16461646
</programlisting>
16471647

16481648
<para>
@@ -1662,7 +1662,7 @@ CREATE POLICY user_policy ON users
16621662
<programlisting>
16631663
-- Simple passwd-file based example
16641664
CREATE TABLE passwd (
1665-
username text UNIQUE NOT NULL,
1665+
user_name text UNIQUE NOT NULL,
16661666
pwhash text,
16671667
uid int PRIMARY KEY,
16681668
gid int NOT NULL,
@@ -1696,17 +1696,17 @@ CREATE POLICY all_view ON passwd FOR SELECT USING (true);
16961696
-- Normal users can update their own records, but
16971697
-- limit which shells a normal user is allowed to set
16981698
CREATE POLICY user_mod ON passwd FOR UPDATE
1699-
USING (current_user =username)
1699+
USING (current_user =user_name)
17001700
WITH CHECK (
1701-
current_user =username AND
1701+
current_user =user_name AND
17021702
shell IN ('/bin/bash','/bin/sh','/bin/dash','/bin/zsh','/bin/tcsh')
17031703
);
17041704

17051705
-- Allow admin all normal rights
17061706
GRANT SELECT, INSERT, UPDATE, DELETE ON passwd TO admin;
17071707
-- Users only get select access on public columns
17081708
GRANT SELECT
1709-
(username, uid, gid, real_name, home_phone, extra_info, home_dir, shell)
1709+
(user_name, uid, gid, real_name, home_phone, extra_info, home_dir, shell)
17101710
ON passwd TO public;
17111711
-- Allow users to update certain columns
17121712
GRANT UPDATE
@@ -1725,38 +1725,38 @@ GRANT UPDATE
17251725
postgres=&gt; set role admin;
17261726
SET
17271727
postgres=&gt; table passwd;
1728-
username | pwhash | uid | gid | real_name | home_phone | extra_info | home_dir | shell
1729-
----------+--------+-----+-----+-----------+--------------+------------+-------------+-----------
1730-
admin | xxx | 0 | 0 | Admin | 111-222-3333 | | /root | /bin/dash
1731-
bob | xxx | 1 | 1 | Bob | 123-456-7890 | | /home/bob | /bin/zsh
1732-
alice | xxx | 2 | 1 | Alice | 098-765-4321 | | /home/alice | /bin/zsh
1728+
user_name | pwhash | uid | gid | real_name | home_phone | extra_info | home_dir | shell
1729+
-----------+--------+-----+-----+-----------+--------------+------------+-------------+-----------
1730+
admin| xxx | 0 | 0 | Admin | 111-222-3333 | | /root | /bin/dash
1731+
bob| xxx | 1 | 1 | Bob | 123-456-7890 | | /home/bob | /bin/zsh
1732+
alice| xxx | 2 | 1 | Alice | 098-765-4321 | | /home/alice | /bin/zsh
17331733
(3 rows)
17341734

17351735
-- Test what Alice is able to do
17361736
postgres=&gt; set role alice;
17371737
SET
17381738
postgres=&gt; table passwd;
17391739
ERROR: permission denied for relation passwd
1740-
postgres=&gt; selectusername,real_name,home_phone,extra_info,home_dir,shell from passwd;
1741-
username | real_name | home_phone | extra_info | home_dir | shell
1742-
----------+-----------+--------------+------------+-------------+-----------
1743-
admin | Admin | 111-222-3333 | | /root | /bin/dash
1744-
bob | Bob | 123-456-7890 | | /home/bob | /bin/zsh
1745-
alice | Alice | 098-765-4321 | | /home/alice | /bin/zsh
1740+
postgres=&gt; selectuser_name,real_name,home_phone,extra_info,home_dir,shell from passwd;
1741+
user_name | real_name | home_phone | extra_info | home_dir | shell
1742+
-----------+-----------+--------------+------------+-------------+-----------
1743+
admin| Admin | 111-222-3333 | | /root | /bin/dash
1744+
bob| Bob | 123-456-7890 | | /home/bob | /bin/zsh
1745+
alice| Alice | 098-765-4321 | | /home/alice | /bin/zsh
17461746
(3 rows)
17471747

1748-
postgres=&gt; update passwd setusername = 'joe';
1748+
postgres=&gt; update passwd setuser_name = 'joe';
17491749
ERROR: permission denied for relation passwd
17501750
-- Alice is allowed to change her own real_name, but no others
17511751
postgres=&gt; update passwd set real_name = 'Alice Doe';
17521752
UPDATE 1
1753-
postgres=&gt; update passwd set real_name = 'John Doe' whereusername = 'admin';
1753+
postgres=&gt; update passwd set real_name = 'John Doe' whereuser_name = 'admin';
17541754
UPDATE 0
17551755
postgres=&gt; update passwd set shell = '/bin/xx';
17561756
ERROR: new row violates WITH CHECK OPTION for "passwd"
17571757
postgres=&gt; delete from passwd;
17581758
ERROR: permission denied for relation passwd
1759-
postgres=&gt; insert into passwd (username) values ('xxx');
1759+
postgres=&gt; insert into passwd (user_name) values ('xxx');
17601760
ERROR: permission denied for relation passwd
17611761
-- Alice can change her own password; RLS silently prevents updating other rows
17621762
postgres=&gt; update passwd set pwhash = 'abc';
@@ -2055,7 +2055,7 @@ DROP SCHEMA myschema CASCADE;
20552055
(since this is one of the ways to restrict the activities of your
20562056
users to well-defined namespaces). The syntax for that is:
20572057
<programlisting>
2058-
CREATE SCHEMA <replaceable>schemaname</replaceable> AUTHORIZATION <replaceable>username</replaceable>;
2058+
CREATE SCHEMA <replaceable>schema_name</replaceable> AUTHORIZATION <replaceable>user_name</replaceable>;
20592059
</programlisting>
20602060
You can even omit the schema name, in which case the schema name
20612061
will be the same as the user name. See <xref
@@ -2344,7 +2344,7 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC;
23442344
implements only the basic schema support specified in the
23452345
standard. Therefore, many users consider qualified names to
23462346
really consist of
2347-
<literal><replaceable>username</>.<replaceable>tablename</></literal>.
2347+
<literal><replaceable>user_name</>.<replaceable>table_name</></literal>.
23482348
This is how <productname>PostgreSQL</productname> will effectively
23492349
behave if you create a per-user schema for every user.
23502350
</para>

‎doc/src/sgml/extend.sgml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,13 @@
335335
by <application>pg_dump</>. Such a change is usually only sensible if
336336
you concurrently make the same change in the extension's script file.
337337
(But there are special provisions for tables containing configuration
338-
data; see below.)
338+
data; see <xref linkend="extend-extensions-config-tables">.)
339+
In production situations, it's generally better to create an extension
340+
update script to perform changes to extension member objects.
339341
</para>
340342

341343
<para>
342-
The extension script may set privileges on objectswhich are part of the
344+
The extension script may set privileges on objectsthat are part of the
343345
extension via <command>GRANT</command> and <command>REVOKE</command>
344346
statements. The final set of privileges for each object (if any are set)
345347
will be stored in the
@@ -453,9 +455,11 @@
453455
<term><varname>comment</varname> (<type>string</type>)</term>
454456
<listitem>
455457
<para>
456-
A comment (any string) about the extension. Alternatively,
457-
the comment can be set by means of the <xref linkend="sql-comment">
458-
command in the script file.
458+
A comment (any string) about the extension. The comment is applied
459+
when initially creating an extension, but not during extension updates
460+
(since that might override user-added comments). Alternatively,
461+
the extension's comment can be set by writing
462+
a <xref linkend="sql-comment"> command in the script file.
459463
</para>
460464
</listitem>
461465
</varlistentry>
@@ -518,7 +522,7 @@
518522
its contained objects into a different schema after initial creation
519523
of the extension. The default is <literal>false</>, i.e. the
520524
extension is not relocatable.
521-
Seebelow for more information.
525+
See<xref linkend="extend-extensions-relocation"> for more information.
522526
</para>
523527
</listitem>
524528
</varlistentry>
@@ -529,7 +533,10 @@
529533
<para>
530534
This parameter can only be set for non-relocatable extensions.
531535
It forces the extension to be loaded into exactly the named schema
532-
and not any other. See below for more information.
536+
and not any other.
537+
The <varname>schema</varname> parameter is consulted only when
538+
initially creating an extension, not during extension updates.
539+
See <xref linkend="extend-extensions-relocation"> for more information.
533540
</para>
534541
</listitem>
535542
</varlistentry>
@@ -562,7 +569,8 @@
562569
comments) by the extension mechanism. This provision is commonly used
563570
to throw an error if the script file is fed to <application>psql</>
564571
rather than being loaded via <command>CREATE EXTENSION</> (see example
565-
script below). Without that, users might accidentally load the
572+
script in <xref linkend="extend-extensions-example">).
573+
Without that, users might accidentally load the
566574
extension's contents as <quote>loose</> objects rather than as an
567575
extension, a state of affairs that's a bit tedious to recover from.
568576
</para>
@@ -580,7 +588,7 @@
580588

581589
</sect2>
582590

583-
<sect2>
591+
<sect2 id="extend-extensions-relocation">
584592
<title>Extension Relocatability</title>
585593

586594
<para>
@@ -678,7 +686,7 @@ SET LOCAL search_path TO @extschema@;
678686
</para>
679687
</sect2>
680688

681-
<sect2>
689+
<sect2 id="extend-extensions-config-tables">
682690
<title>Extension Configuration Tables</title>
683691

684692
<para>
@@ -762,7 +770,7 @@ SELECT pg_catalog.pg_extension_config_dump('my_config', 'WHERE NOT standard_entr
762770
out but the dump will not be able to be restored directly and user
763771
intervention will be required.
764772
</para>
765-
773+
766774
<para>
767775
Sequences associated with <type>serial</> or <type>bigserial</> columns
768776
need to be directly marked to dump their state. Marking their parent
@@ -877,7 +885,7 @@ SELECT * FROM pg_extension_update_paths('<replaceable>extension_name</>');
877885
</para>
878886
</sect2>
879887

880-
<sect2>
888+
<sect2 id="extend-extensions-example">
881889
<title>Extension Example</title>
882890

883891
<para>

‎doc/src/sgml/func.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9460,7 +9460,7 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
94609460
<literal><function>ts_filter(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">weights</replaceable> <type>"char"[]</>)</function></literal>
94619461
</entry>
94629462
<entry><type>tsvector</type></entry>
9463-
<entry>Select only elements with given <replaceable class="PARAMETER">weights</replaceable> from <replaceable class="PARAMETER">vector</replaceable></entry>
9463+
<entry>select only elements with given <replaceable class="PARAMETER">weights</replaceable> from <replaceable class="PARAMETER">vector</replaceable></entry>
94649464
<entry><literal>ts_filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}')</literal></entry>
94659465
<entry><literal>'cat':3B 'rat':5A</literal></entry>
94669466
</row>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp