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

Commitd55509c

Browse files
committed
Merge branch 'REL9_5_STABLE' into PGPRO9_5
Conflicts:doc/src/sgml/ref/create_index.sgml
2 parents5efaafc +8ef3d9f commitd55509c

File tree

21 files changed

+156
-61
lines changed

21 files changed

+156
-61
lines changed

‎contrib/postgres_fdw/deparse.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,10 +1806,27 @@ deparseNullTest(NullTest *node, deparse_expr_cxt *context)
18061806

18071807
appendStringInfoChar(buf,'(');
18081808
deparseExpr(node->arg,context);
1809-
if (node->nulltesttype==IS_NULL)
1810-
appendStringInfoString(buf," IS NULL)");
1809+
1810+
/*
1811+
* For scalar inputs, we prefer to print as IS [NOT] NULL, which is
1812+
* shorter and traditional. If it's a rowtype input but we're applying a
1813+
* scalar test, must print IS [NOT] DISTINCT FROM NULL to be semantically
1814+
* correct.
1815+
*/
1816+
if (node->argisrow|| !type_is_rowtype(exprType((Node*)node->arg)))
1817+
{
1818+
if (node->nulltesttype==IS_NULL)
1819+
appendStringInfoString(buf," IS NULL)");
1820+
else
1821+
appendStringInfoString(buf," IS NOT NULL)");
1822+
}
18111823
else
1812-
appendStringInfoString(buf," IS NOT NULL)");
1824+
{
1825+
if (node->nulltesttype==IS_NULL)
1826+
appendStringInfoString(buf," IS NOT DISTINCT FROM NULL)");
1827+
else
1828+
appendStringInfoString(buf," IS DISTINCT FROM NULL)");
1829+
}
18131830
}
18141831

18151832
/*

‎doc/src/sgml/information_schema.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5881,7 +5881,7 @@ ORDER BY c.ordinal_position;
58815881
The view <literal>udt_privileges</literal> identifies
58825882
<literal>USAGE</literal> privileges granted on user-defined types to a
58835883
currently enabled role or by a currently enabled role. There is one row for
5884-
each combination ofcolumn, grantor, and grantee. This view shows only
5884+
each combination oftype, grantor, and grantee. This view shows only
58855885
composite types (see under <xref linkend="infoschema-user-defined-types">
58865886
for why); see
58875887
<xref linkend="infoschema-usage-privileges"> for domain privileges.

‎doc/src/sgml/ref/create_table.sgml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -329,51 +329,60 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
329329
table.
330330
</para>
331331
<para>
332-
Default expressions for the copied column definitions will only be
333-
copied if <literal>INCLUDING DEFAULTS</literal> is specified.
334-
Defaults that call database-modification functions, like
335-
<function>nextval</>, create a linkage between the original and
336-
new tables. The
332+
Default expressions for the copied column definitions will be copied
333+
only if <literal>INCLUDING DEFAULTS</literal> is specified. The
337334
default behavior is to exclude default expressions, resulting in the
338335
copied columns in the new table having null defaults.
336+
Note that copying defaults that call database-modification functions,
337+
such as <function>nextval</>, may create a functional linkage between
338+
the original and new tables.
339339
</para>
340340
<para>
341341
Not-null constraints are always copied to the new table.
342342
<literal>CHECK</literal> constraints will be copied only if
343343
<literal>INCLUDING CONSTRAINTS</literal> is specified.
344-
Indexes, <literal>PRIMARY KEY</>, and <literal>UNIQUE</> constraints
345-
on the original table will be created on the new table only if the
346-
<literal>INCLUDING INDEXES</literal> clause is specified.
347344
No distinction is made between column constraints and table
348345
constraints.
349346
</para>
350-
<para><literal>STORAGE</> settings for the copied column definitions will only
351-
be copied if <literal>INCLUDING STORAGE</literal> is specified. The
347+
<para>
348+
Indexes, <literal>PRIMARY KEY</>, <literal>UNIQUE</>,
349+
and <literal>EXCLUDE</> constraints on the original table will be
350+
created on the new table only if <literal>INCLUDING INDEXES</literal>
351+
is specified. Names for the new indexes and constraints are
352+
chosen according to the default rules, regardless of how the originals
353+
were named. (This behavior avoids possible duplicate-name failures for
354+
the new indexes.)
355+
</para>
356+
<para>
357+
<literal>STORAGE</> settings for the copied column definitions will be
358+
copied only if <literal>INCLUDING STORAGE</literal> is specified. The
352359
default behavior is to exclude <literal>STORAGE</> settings, resulting
353360
in the copied columns in the new table having type-specific default
354361
settings. For more on <literal>STORAGE</> settings, see
355362
<xref linkend="storage-toast">.
356363
</para>
357364
<para>
358365
Comments for the copied columns, constraints, and indexes
359-
willonlybe copied if <literal>INCLUDING COMMENTS</literal>
366+
will be copied only if <literal>INCLUDING COMMENTS</literal>
360367
is specified. The default behavior is to exclude comments, resulting in
361368
the copied columns and constraints in the new table having no comments.
362369
</para>
363-
<para><literal>INCLUDING ALL</literal> is an abbreviated form of
370+
<para>
371+
<literal>INCLUDING ALL</literal> is an abbreviated form of
364372
<literal>INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS</literal>.
365373
</para>
366374
<para>
367-
Notealsothat unlike <literal>INHERITS</literal>, columns and
375+
Note that unlike <literal>INHERITS</literal>, columns and
368376
constraints copied by <literal>LIKE</> are not merged with similarly
369377
named columns and constraints.
370378
If the same name is specified explicitly or in another
371379
<literal>LIKE</literal> clause, an error is signaled.
372380
</para>
373381
<para>
374-
The <literal>LIKE</literal> clause can also be used to copy columns from
375-
views, foreign tables, or composite types. Inapplicable options (e.g., <literal>INCLUDING
376-
INDEXES</literal> from a view) are ignored.
382+
The <literal>LIKE</literal> clause can also be used to copy column
383+
definitions from views, foreign tables, or composite types.
384+
Inapplicable options (e.g., <literal>INCLUDING INDEXES</literal> from
385+
a view) are ignored.
377386
</para>
378387
</listitem>
379388
</varlistentry>
@@ -1514,6 +1523,17 @@ CREATE TABLE employees OF employee_type (
15141523
</para>
15151524
</refsect2>
15161525

1526+
<refsect2>
1527+
<title><literal>LIKE</> Clause</title>
1528+
1529+
<para>
1530+
While a <literal>LIKE</> clause exists in the SQL standard, many of the
1531+
options that <productname>PostgreSQL</productname> accepts for it are not
1532+
in the standard, and some of the standard's options are not implemented
1533+
by <productname>PostgreSQL</productname>.
1534+
</para>
1535+
</refsect2>
1536+
15171537
<refsect2>
15181538
<title><literal>WITH</> Clause</title>
15191539

‎doc/src/sgml/ref/pg_basebackup.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ doc/src/sgml/ref/pg_basebackup.sgml
364364
<listitem>
365365
<para>
366366
Enables gzip compression of tar file output, and specifies the
367-
compression level (1 through 9, 9 being best
367+
compression level (0 through 9, 0 being no compression and 9 being best
368368
compression). Compression is only available when using the tar
369369
format.
370370
</para>

‎doc/src/sgml/ref/pgbench.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ END;
10451045
within the interval, <replaceable>latency_sum</replaceable> is a sum of latencies
10461046
(so you can compute average latency easily). The following two fields are useful
10471047
for variance estimation - <replaceable>latency_sum</> is a sum of latencies and
1048-
<replaceable>latency_2_sum</> is a sum of 2nd powers of latencies. Thelast two
1048+
<replaceable>latency_2_sum</> is a sum of 2nd powers of latencies. Thenext two
10491049
fields are <replaceable>min_latency</> - a minimum latency within the interval, and
10501050
<replaceable>max_latency</> - maximum latency within the interval. A transaction is
10511051
counted into the interval when it was committed. The fields in the end,

‎doc/src/sgml/runtime.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput>
184184
</para>
185185

186186
<para>
187-
Non<literal>C</> and and non-<literal>POSIX</> locales rely on the
187+
Non-<literal>C</> and and non-<literal>POSIX</> locales rely on the
188188
operating system's collation library for character set ordering.
189189
This controls the ordering of keys stored in indexes. For this reason,
190190
a cluster cannot switch to an incompatible collation library version,

‎src/backend/libpq/pqmq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ mq_putmessage(char msgtype, const char *s, size_t len)
172172
break;
173173

174174
WaitLatch(&MyProc->procLatch,WL_LATCH_SET,0);
175-
CHECK_FOR_INTERRUPTS();
176175
ResetLatch(&MyProc->procLatch);
176+
CHECK_FOR_INTERRUPTS();
177177
}
178178

179179
pq_mq_busy= false;

‎src/backend/optimizer/util/plancat.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,13 @@ get_relation_constraints(PlannerInfo *root,
10971097
att->attcollation,
10981098
0);
10991099
ntest->nulltesttype=IS_NOT_NULL;
1100-
ntest->argisrow=type_is_rowtype(att->atttypid);
1100+
1101+
/*
1102+
* argisrow=false is correct even for a composite column,
1103+
* because attnotnull does not represent a SQL-spec IS NOT
1104+
* NULL test in such a case, just IS DISTINCT FROM NULL.
1105+
*/
1106+
ntest->argisrow= false;
11011107
ntest->location=-1;
11021108
result=lappend(result,ntest);
11031109
}

‎src/backend/parser/parse_utilcmd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,9 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
10951095

10961096
/*
10971097
* We don't try to preserve the name of the source index; instead, just
1098-
* let DefineIndex() choose a reasonable name.
1098+
* let DefineIndex() choose a reasonable name. (If we tried to preserve
1099+
* the name, we'd get duplicate-relation-name failures unless the source
1100+
* table was in a different schema.)
10991101
*/
11001102
index->idxname=NULL;
11011103

‎src/backend/storage/ipc/shm_mq.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -868,11 +868,11 @@ shm_mq_send_bytes(shm_mq_handle *mqh, Size nbytes, const void *data,
868868
*/
869869
WaitLatch(MyLatch,WL_LATCH_SET,0);
870870

871-
/* An interrupt may have occurred while we were waiting. */
872-
CHECK_FOR_INTERRUPTS();
873-
874871
/* Reset the latch so we don't spin. */
875872
ResetLatch(MyLatch);
873+
874+
/* An interrupt may have occurred while we were waiting. */
875+
CHECK_FOR_INTERRUPTS();
876876
}
877877
else
878878
{
@@ -965,11 +965,11 @@ shm_mq_receive_bytes(shm_mq *mq, Size bytes_needed, bool nowait,
965965
*/
966966
WaitLatch(MyLatch,WL_LATCH_SET,0);
967967

968-
/* An interrupt may have occurred while we were waiting. */
969-
CHECK_FOR_INTERRUPTS();
970-
971968
/* Reset the latch so we don't spin. */
972969
ResetLatch(MyLatch);
970+
971+
/* An interrupt may have occurred while we were waiting. */
972+
CHECK_FOR_INTERRUPTS();
973973
}
974974
}
975975

@@ -1071,11 +1071,11 @@ shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile * ptr,
10711071
/* Wait to be signalled. */
10721072
WaitLatch(MyLatch,WL_LATCH_SET,0);
10731073

1074-
/* An interrupt may have occurred while we were waiting. */
1075-
CHECK_FOR_INTERRUPTS();
1076-
10771074
/* Reset the latch so we don't spin. */
10781075
ResetLatch(MyLatch);
1076+
1077+
/* An interrupt may have occurred while we were waiting. */
1078+
CHECK_FOR_INTERRUPTS();
10791079
}
10801080
}
10811081
PG_CATCH();

‎src/backend/utils/adt/ruleutils.c

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7928,17 +7928,43 @@ get_rule_expr(Node *node, deparse_context *context,
79287928
if (!PRETTY_PAREN(context))
79297929
appendStringInfoChar(buf,'(');
79307930
get_rule_expr_paren((Node*)ntest->arg,context, true,node);
7931-
switch (ntest->nulltesttype)
7931+
7932+
/*
7933+
* For scalar inputs, we prefer to print as IS [NOT] NULL,
7934+
* which is shorter and traditional. If it's a rowtype input
7935+
* but we're applying a scalar test, must print IS [NOT]
7936+
* DISTINCT FROM NULL to be semantically correct.
7937+
*/
7938+
if (ntest->argisrow||
7939+
!type_is_rowtype(exprType((Node*)ntest->arg)))
79327940
{
7933-
caseIS_NULL:
7934-
appendStringInfoString(buf," IS NULL");
7935-
break;
7936-
caseIS_NOT_NULL:
7937-
appendStringInfoString(buf," IS NOT NULL");
7938-
break;
7939-
default:
7940-
elog(ERROR,"unrecognized nulltesttype: %d",
7941-
(int)ntest->nulltesttype);
7941+
switch (ntest->nulltesttype)
7942+
{
7943+
caseIS_NULL:
7944+
appendStringInfoString(buf," IS NULL");
7945+
break;
7946+
caseIS_NOT_NULL:
7947+
appendStringInfoString(buf," IS NOT NULL");
7948+
break;
7949+
default:
7950+
elog(ERROR,"unrecognized nulltesttype: %d",
7951+
(int)ntest->nulltesttype);
7952+
}
7953+
}
7954+
else
7955+
{
7956+
switch (ntest->nulltesttype)
7957+
{
7958+
caseIS_NULL:
7959+
appendStringInfoString(buf," IS NOT DISTINCT FROM NULL");
7960+
break;
7961+
caseIS_NOT_NULL:
7962+
appendStringInfoString(buf," IS DISTINCT FROM NULL");
7963+
break;
7964+
default:
7965+
elog(ERROR,"unrecognized nulltesttype: %d",
7966+
(int)ntest->nulltesttype);
7967+
}
79427968
}
79437969
if (!PRETTY_PAREN(context))
79447970
appendStringInfoChar(buf,')');

‎src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ main(int argc, char **argv)
20622062
break;
20632063
case'Z':
20642064
compresslevel=atoi(optarg);
2065-
if (compresslevel <=0||compresslevel>9)
2065+
if (compresslevel<0||compresslevel>9)
20662066
{
20672067
fprintf(stderr,_("%s: invalid compression level \"%s\"\n"),
20682068
progname,optarg);

‎src/bin/pg_upgrade/server.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
174174
{
175175
charcmd[MAXPGPATH*4+1000];
176176
PGconn*conn;
177-
boolexit_hook_registered= false;
178177
boolpg_ctl_return= false;
179178
charsocket_string[MAXPGPATH+200];
180179

180+
staticboolexit_hook_registered= false;
181+
181182
if (!exit_hook_registered)
182183
{
183184
atexit(stop_postmaster_atexit);

‎src/bin/psql/input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ gets_fromFile(FILE *source)
218218
}
219219

220220
/* EOL? */
221-
if (buffer->data[buffer->len-1]=='\n')
221+
if (buffer->len>0&&buffer->data[buffer->len-1]=='\n')
222222
{
223223
buffer->data[buffer->len-1]='\0';
224224
returnpg_strdup(buffer->data);

‎src/include/libpq/libpq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extern PGDLLIMPORT PQcommMethods *PqCommMethods;
4242
#definepq_putmessage(msgtype,s,len) \
4343
(PqCommMethods->putmessage(msgtype, s, len))
4444
#definepq_putmessage_noblock(msgtype,s,len) \
45-
(PqCommMethods->putmessage(msgtype, s, len))
45+
(PqCommMethods->putmessage_noblock(msgtype, s, len))
4646
#definepq_startcopyout() (PqCommMethods->startcopyout())
4747
#definepq_endcopyout(errorAbort) (PqCommMethods->endcopyout(errorAbort))
4848

‎src/include/nodes/primnodes.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,8 +1076,16 @@ typedef struct XmlExpr
10761076
* NullTest represents the operation of testing a value for NULLness.
10771077
* The appropriate test is performed and returned as a boolean Datum.
10781078
*
1079-
* NOTE: the semantics of this for rowtype inputs are noticeably different
1080-
* from the scalar case. We provide an "argisrow" flag to reflect that.
1079+
* When argisrow is false, this simply represents a test for the null value.
1080+
*
1081+
* When argisrow is true, the input expression must yield a rowtype, and
1082+
* the node implements "row IS [NOT] NULL" per the SQL standard. This
1083+
* includes checking individual fields for NULLness when the row datum
1084+
* itself isn't NULL.
1085+
*
1086+
* NOTE: the combination of a rowtype input and argisrow==false does NOT
1087+
* correspond to the SQL notation "row IS [NOT] NULL"; instead, this case
1088+
* represents the SQL notation "row IS [NOT] DISTINCT FROM NULL".
10811089
* ----------------
10821090
*/
10831091

@@ -1091,7 +1099,7 @@ typedef struct NullTest
10911099
Exprxpr;
10921100
Expr*arg;/* input expression */
10931101
NullTestTypenulltesttype;/* IS NULL, IS NOT NULL */
1094-
boolargisrow;/* Tif input is of a composite type */
1102+
boolargisrow;/* Tto perform field-by-field null checks */
10951103
intlocation;/* token location, or -1 if unknown */
10961104
}NullTest;
10971105

‎src/include/storage/latch.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@
5252
* do. Otherwise, if someone sets the latch between the check and the
5353
* ResetLatch call, you will miss it and Wait will incorrectly block.
5454
*
55+
* Another valid coding pattern looks like:
56+
*
57+
* for (;;)
58+
* {
59+
* if (work to do)
60+
* Do Stuff(); // in particular, exit loop if some condition satisfied
61+
* WaitLatch();
62+
* ResetLatch();
63+
* }
64+
*
65+
* This is useful to reduce latch traffic if it's expected that the loop's
66+
* termination condition will often be satisfied in the first iteration;
67+
* the cost is an extra loop iteration before blocking when it is not.
68+
* What must be avoided is placing any checks for asynchronous events after
69+
* WaitLatch and before ResetLatch, as that creates a race condition.
70+
*
5571
* To wake up the waiter, you must first set a global flag or something
5672
* else that the wait loop tests in the "if (work to do)" part, and call
5773
* SetLatch *after* that. SetLatch is designed to return quickly if the

‎src/interfaces/ecpg/ecpglib/data.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
375375
#ifdefHAVE_STRTOULL
376376
caseECPGt_unsigned_long_long:
377377
*((unsigned long longint*) (var+offset*act_tuple))=strtoull(pval,&scan_length,10);
378-
if ((isarray&&*scan_length!=','&&*scan_length!='}')
379-
|| (!isarray&& !(INFORMIX_MODE(compat)&&*scan_length=='.')&&*scan_length!='\0'&&*scan_length!=' '))/* Garbage left */
378+
if (garbage_left(isarray,scan_length,compat))
380379
{
381380
ecpg_raise(lineno,ECPG_UINT_FORMAT,ECPG_SQLSTATE_DATATYPE_MISMATCH,pval);
382381
return (false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp